Thanks a lot for your kind words..comments like these are my inspiration.. thanks again... 🙏🙏🙏 if you like my contents..please share the same with family and friends 🙏
I have an interview coming up and I needed someone to summarize indexing in Mongo for me and you've done it so concisely and smoothly ! Thank you so much for this. Even though your video is on the top of my searches I'm not sure why the views are less !!! :( Anyways keep posting great videos like this :)
When the collection is indexed on "salary" and you query for a specific salary, how come "index keys examined" is always 1. Will there not be an index scan examining "some" of the index keys until the required salary is found? I would expect "index keys examined" to be > 1 for some of the case. But it never is. Why? How does MongoDB get to a specific salary in just 1 lookup? Even in your example at 16:23, MongoDB would have examined 3 index keys to get to salary 3 (as opposed to 1 as claimed by Explain Plan).
because they store the indexes in memory adress format indexes is created to map the adress of memory that created, so dsnt need search already know memory adress and can always go straight to adress that already save
dnt look at the data as UTF-8 format, they store that on binary format so even 1 character and length difference can mean a lot, look at C programming lang destructure String and you will be surprise
Its so confusing for me to understand, when we create an index data structure with desired indexed field, how can it instantly return an result if the entity in that "index data structure" is not the only one and it should still have to be search but way more efficiently due to the sorting that helps in searching by binary search algo if I understand this correctly, only then it maps to the corresponding result to the real data structure in heap or something.. where am i wrong?
I have an app in which user create their own post and each post stored in form of document now if the need is like insertion order should not be in ascending or descending order. It should be in random order. can we achieve this in mongodb?
Can a query use multiple indexes(non-compound)? When I ran a query, it was only using one index even though all the query fields were indexed. And mongodb was also doing in-memory sorting (my sort field is also indexed in proper sort order).
Indexes are special data structures [1] that store a small portion of the collection's data set in an easy to traverse form. The data structure used is a B Tree. This is from the documentation. How does that work exactly?
Thanks for your comment.. I am not sure that I understand your query but I believe when you create a new index a btree is created.. hope it helps..thanks
does this mean the salary field should always be unique?
Год назад
How do I use the index in a querie? My queries are like this: db.getCollection('table1').aggregate([{ $project: { field1: 1, field2: 1, field3: 1 } }]). How do I use the index on this querie?