MongoDB Indexes - The Recipe behind Fast Query - How to Create Indexes and the B-Tree Data Structure

  Рет қаралды 55,887

Cognitive Programmer

Cognitive Programmer

Күн бұрын

Welcome to the MongoDB Video Series. In this video, I'm talking about MongoDB indexes. Indexes drastically impacts the performance of MongoDB especially the search queries
It's highly unlikely that you can use MongoDB in production without MongoDB indexes
In this video, I've created our own data and then apply mongodb indexes into them to see the performance difference.
Not only that, I've also visually explained the B-Tree data structures which is used while creating MongoDB index
Hope it help you to learn something new. Thanks for tuning in and watching
#Mongodb #NoSQL #database
About Me i.e. An Insightful Techie
Greetings and Thanks a lot for checking out my KZbin Channel. I’m Deepak K Gupta (Daksh). This channel is a medium for me to share my learnings and journey as a Techie so that you not only learn from my experience but also from my mistakes
As a techie I am closely associated with software development, so most of my content will revolve around Programming Languages, AI, Machine learning and Databases. I share things which will help you learn, remember and use these things in an effective and efficient way.
As a Techie, I also know that there is a life beyond software development and it has a profound impact on our career as well as on our well being. I also share those learnings which I feel are worth sharing with the intention that it MAY help you in taking better decisions in your life.
Last but not the least, I'm a traveler and explorer by nature. I would like to take you with me on some of the interesting journeys around the world. Believe me there is more to learn outdoors than indoors
Hope you’ll like my contents and will be part of my journey 🙏
SUBSCRIBE - kzbin.info...
INSTAGRAM - www.intagram.com/AnInsightful...
Twitter - / awisetechie
Facebook - / aninsightfultechie

Пікірлер: 115
@harshvardhanpurohit3396
@harshvardhanpurohit3396 3 жыл бұрын
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 :)
@Cognitive-Programmer
@Cognitive-Programmer 3 жыл бұрын
Thanks a lot for your kind and encouraging words. All the very best for your interview 🙏🙏🙏
@ShahanaBasheer
@ShahanaBasheer 2 ай бұрын
Excellent video...❤ fully understandable❤ thank you so much😊
@Cognitive-Programmer
@Cognitive-Programmer 2 ай бұрын
Thank you so much for your kind comment 🙏
@hackingguy
@hackingguy 3 жыл бұрын
Such a elegant explanation, Sir! I think you deserve more views, Try increasing camera and thumbnail quality, It will help you a lot!
@Cognitive-Programmer
@Cognitive-Programmer 3 жыл бұрын
Thanks for your kind words and thanks a lot for your valuable suggestion 🙏🙏🙏
@ryanaiden
@ryanaiden 3 жыл бұрын
Good Sir you are an excellent teacher. Well done on this superb explanation. “Isn’t it cool?” Yes it is very cool! Thanks you for the video.
@Cognitive-Programmer
@Cognitive-Programmer 3 жыл бұрын
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 🙏
@akashpundir908
@akashpundir908 3 жыл бұрын
That was a beautiful explanation of Indexes! Don't know why so less views, it's better than other videos on indexes.
@Cognitive-Programmer
@Cognitive-Programmer 3 жыл бұрын
Thanks a lot for your comment 🙏🙏🙏 I do wonder myself about this but your comment made my day. Thanks again 🙏🙏🙏
@mustaphag
@mustaphag Жыл бұрын
Excellent
@Cognitive-Programmer
@Cognitive-Programmer Жыл бұрын
Thanks for your comment 🙏
@piyalibanik5153
@piyalibanik5153 2 жыл бұрын
Wow wonderfully explained... in simple clear language... thanks a lot 🙏
@Cognitive-Programmer
@Cognitive-Programmer 2 жыл бұрын
Thank you for your comment 🙏
@mdjawedalam722
@mdjawedalam722 6 ай бұрын
great explanation sir thanks may allah bless you
@Cognitive-Programmer
@Cognitive-Programmer 6 ай бұрын
Thank you so much for your comment 🙏
@kamichikora6035
@kamichikora6035 2 жыл бұрын
Great video
@Cognitive-Programmer
@Cognitive-Programmer 2 жыл бұрын
Thank you 🙏
@kydang4530
@kydang4530 2 жыл бұрын
awesome
@Cognitive-Programmer
@Cognitive-Programmer 2 жыл бұрын
Thanks for your comment 🙏🙏🙏
@rishabhanda5903
@rishabhanda5903 Жыл бұрын
Concept is explained beautifully in great detail. Thanks for sharing knowledge
@Cognitive-Programmer
@Cognitive-Programmer Жыл бұрын
Thanks for your comment 🙏
@anandagarwal291
@anandagarwal291 Жыл бұрын
best video till date related to indexes . thanks a lot
@Cognitive-Programmer
@Cognitive-Programmer Жыл бұрын
Thanks for your comment 🙏
@tusharagrawal5458
@tusharagrawal5458 2 жыл бұрын
Great explanation
@Cognitive-Programmer
@Cognitive-Programmer 2 жыл бұрын
Thanks for your comment 🙏
@padmakarkasture2969
@padmakarkasture2969 2 жыл бұрын
explanation with live example ..so nice thanks
@Cognitive-Programmer
@Cognitive-Programmer 2 жыл бұрын
Thanks for your comment 🙏🙏🙏
@shreyashachoudhary480
@shreyashachoudhary480 Жыл бұрын
Epic
@Cognitive-Programmer
@Cognitive-Programmer Жыл бұрын
Thanks a lot 🙏
@karanbobade5266
@karanbobade5266 2 жыл бұрын
good explaination
@Cognitive-Programmer
@Cognitive-Programmer 2 жыл бұрын
Thanks for your comment 🙏🙏🙏
@hsiang-yehhwang2625
@hsiang-yehhwang2625 2 жыл бұрын
This is a great tutorial!! Thanks for the sharing!!
@Cognitive-Programmer
@Cognitive-Programmer 2 жыл бұрын
Thanks a lot for your comment 🙏🙏🙏
@TheMeepPlay
@TheMeepPlay Жыл бұрын
Excelent video! thanks so much for the explanation.
@Cognitive-Programmer
@Cognitive-Programmer Жыл бұрын
Thanks for your comment 🙏
@haouihamza9178
@haouihamza9178 Жыл бұрын
Thanks for the video
@Cognitive-Programmer
@Cognitive-Programmer Жыл бұрын
Thanks for your comment 🙏
@itsnagma77
@itsnagma77 3 жыл бұрын
Best explanation 🥰 Thank you sir
@Cognitive-Programmer
@Cognitive-Programmer 3 жыл бұрын
Thanks for your comment 🙏🙏🙏
@dzlandis
@dzlandis Жыл бұрын
This is a great explanation which is super helpful! Thank you :)
@Cognitive-Programmer
@Cognitive-Programmer Жыл бұрын
Thanks a lot for your comment 🙏
@sujith5441
@sujith5441 Жыл бұрын
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).
@alijunaid8160
@alijunaid8160 Жыл бұрын
beautifully explained sir! you are a great teacher, where ever you are you deserve a raise, best wishes from Pakistan
@Cognitive-Programmer
@Cognitive-Programmer Жыл бұрын
Thank you so much for your kind words 🙏
@YMMP940
@YMMP940 3 жыл бұрын
Thank you, this is really helpful !!
@Cognitive-Programmer
@Cognitive-Programmer 3 жыл бұрын
Thanks for your comment 🙏🙏🙏
@danieleirmishin368
@danieleirmishin368 Жыл бұрын
Thank you, very clear explantion 😀
@Cognitive-Programmer
@Cognitive-Programmer Жыл бұрын
Thanks a lot for your comment 🙏
@malayali_from_Coventry
@malayali_from_Coventry 2 жыл бұрын
Hi , I have a doubt , how to index an array field inside a collection ?
@rakeshravig
@rakeshravig 3 жыл бұрын
Is there have any option for Indexing mongodb with django in pycharm
@MdSiam-kw5ox
@MdSiam-kw5ox 3 жыл бұрын
Thanks a lot for the explanation. 👍
@Cognitive-Programmer
@Cognitive-Programmer 3 жыл бұрын
Thanks a lot for your comment 🙏🙏🙏
@gowth_am_m
@gowth_am_m Жыл бұрын
I am really appreciate your work and explanation.👏
@Cognitive-Programmer
@Cognitive-Programmer Жыл бұрын
Thank you so much for your comment 🙏
@atangamathias5165
@atangamathias5165 Жыл бұрын
very well explained
@Cognitive-Programmer
@Cognitive-Programmer Жыл бұрын
Thank for your comment 🙏
@meickl
@meickl 2 жыл бұрын
Very well explained, thanks :)
@Cognitive-Programmer
@Cognitive-Programmer 2 жыл бұрын
Thanks for your comment 🙏
@williamlopez8067
@williamlopez8067 2 жыл бұрын
Thank you Sir, your video help me a lot 👍
@Cognitive-Programmer
@Cognitive-Programmer 2 жыл бұрын
Thanks for your comment 🙏🙏🙏
@Melody-xb2nh
@Melody-xb2nh Жыл бұрын
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?
@rafaelsantos236
@rafaelsantos236 3 жыл бұрын
Thanks for the class!
@Cognitive-Programmer
@Cognitive-Programmer 3 жыл бұрын
Thanks for your comment 🙏🙏🙏
@shivangigupta8196
@shivangigupta8196 3 жыл бұрын
best explanation SIr thanks
@Cognitive-Programmer
@Cognitive-Programmer 3 жыл бұрын
Thanks a lot for your comment 🙏🙏🙏
@techocean6372
@techocean6372 2 жыл бұрын
Sir you explained in next level
@Cognitive-Programmer
@Cognitive-Programmer 2 жыл бұрын
Thank you so much 🙏
@shashiranjan7451
@shashiranjan7451 2 жыл бұрын
very nice. thank you very much
@Cognitive-Programmer
@Cognitive-Programmer 2 жыл бұрын
Thanks a lot for your comment 🙏🙏🙏
@mayurmendhe5979
@mayurmendhe5979 2 жыл бұрын
great explanation sir
@Cognitive-Programmer
@Cognitive-Programmer 2 жыл бұрын
Thanks a lot 🙏
@isi1044
@isi1044 Жыл бұрын
amazing
@Cognitive-Programmer
@Cognitive-Programmer Жыл бұрын
Thank you 🙏
@exe.m1dn1ght
@exe.m1dn1ght 11 ай бұрын
Thank you Sir you are a Great Master !
@Cognitive-Programmer
@Cognitive-Programmer 11 ай бұрын
Thank you so much for your comment 🙏
@1989atul
@1989atul 2 жыл бұрын
how to optimize, if we have lot index in mongodb legacy code. I need to unwanted remove indexes
@sujith5441
@sujith5441 Жыл бұрын
very clear😊
@Cognitive-Programmer
@Cognitive-Programmer Жыл бұрын
Thanks for your comment 🙏
@kornelijussliubauskas8299
@kornelijussliubauskas8299 2 жыл бұрын
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?
@swadhinpanigrahi9717
@swadhinpanigrahi9717 3 жыл бұрын
sir thanks you so much this video is made my day
@Cognitive-Programmer
@Cognitive-Programmer 3 жыл бұрын
Thanks a lot for your comment 🙏🙏🙏
@rezwanmahmud3363
@rezwanmahmud3363 Жыл бұрын
Thanks a lot
@Cognitive-Programmer
@Cognitive-Programmer Жыл бұрын
thanks for your comment 🙏
@jasonhuang4333
@jasonhuang4333 2 жыл бұрын
Very helpful!
@Cognitive-Programmer
@Cognitive-Programmer 2 жыл бұрын
Thanks for your comment 🙏🙏🙏
@staryun2671
@staryun2671 3 жыл бұрын
good!!!
@Cognitive-Programmer
@Cognitive-Programmer 3 жыл бұрын
Thanks for your comment 🙏🙏🙏
@mystic_monk55
@mystic_monk55 2 жыл бұрын
thank you sir
@Cognitive-Programmer
@Cognitive-Programmer 2 жыл бұрын
Thanks a lot for your comment 🙏🙏🙏
@kunalsharma166
@kunalsharma166 3 жыл бұрын
sir you are 🔥🔥🔥🔥best
@Cognitive-Programmer
@Cognitive-Programmer 3 жыл бұрын
Thanks for your kind appreciation 🙏🙏🙏
@benmarshall5109
@benmarshall5109 2 жыл бұрын
thank you
@Cognitive-Programmer
@Cognitive-Programmer 2 жыл бұрын
Thanks for your comment 🙏
@keerthi4513
@keerthi4513 2 жыл бұрын
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).
@tonyhart2744
@tonyhart2744 Жыл бұрын
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
@tonyhart2744
@tonyhart2744 Жыл бұрын
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
@mayankagarwal6300
@mayankagarwal6300 2 жыл бұрын
Very nice explanation have you uploaded the another video on index also.
@Cognitive-Programmer
@Cognitive-Programmer 2 жыл бұрын
No sir no other video is available on this topic ..🙏🙏🙏
@Alphfirm
@Alphfirm 2 жыл бұрын
thanks
@Cognitive-Programmer
@Cognitive-Programmer 2 жыл бұрын
Thanks for your comment 🙏🙏🙏
@sujith5441
@sujith5441 Жыл бұрын
Is it necessary to add indexes for documents with only 2-3 fields?
@Cognitive-Programmer
@Cognitive-Programmer Жыл бұрын
Indexes are necessary for faster lookup, irrespective of number of fields
@nands4410
@nands4410 3 жыл бұрын
Hi sir 9:26 in which video you talk about different options there sir
@Cognitive-Programmer
@Cognitive-Programmer 3 жыл бұрын
Hi Thanks for your comment I have not created the videos yet. Will do sometime in future Sorry about that T hanks🙏🙏🙏
@abhishekvaishnav
@abhishekvaishnav 3 жыл бұрын
Thanks for the video, but can you please provide link to the video you created right after this one?
@Cognitive-Programmer
@Cognitive-Programmer 3 жыл бұрын
Sure thanks for your comment.. I will update when the other video is available 🙏🙏
@abhishekvaishnav
@abhishekvaishnav 3 жыл бұрын
@@Cognitive-Programmer Awesome, Thanks!
@arpitanand6534
@arpitanand6534 2 жыл бұрын
video was very useful but please please fix your microphone!!!!
@_Gunjan
@_Gunjan 2 жыл бұрын
TypeError: Product.createIndex is not a function. i am getting this type error in node js .pleasse help me!!!!
@AnshumanKumar007
@AnshumanKumar007 3 жыл бұрын
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?
@AnshumanKumar007
@AnshumanKumar007 3 жыл бұрын
The B Tree part makes sense when using the index. However, if I use another field as an index, it doesn’t work as well, does it?
@Cognitive-Programmer
@Cognitive-Programmer 3 жыл бұрын
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
@Nadiow613
@Nadiow613 2 жыл бұрын
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?
MongoDB Compound Index and Indexing
9:18
Cognitive Programmer
Рет қаралды 17 М.
Understanding B-Trees: The Data Structure Behind Modern Databases
12:39
ИРИНА КАЙРАТОВНА - АЙДАХАР (БЕКА) [MV]
02:51
ГОСТ ENTERTAINMENT
Рет қаралды 11 МЛН
Nutella bro sis family Challenge 😋
00:31
Mr. Clabik
Рет қаралды 10 МЛН
Каха ограбил банк
01:00
К-Media
Рет қаралды 11 МЛН
B-tree vs B+ tree in Database Systems
31:50
Hussein Nasser
Рет қаралды 49 М.
10.2  B Trees and B+ Trees. How they are useful in Databases
39:41
Abdul Bari
Рет қаралды 1,1 МЛН
MongoDB in 18 Minutes - Intro to MongoDB
17:42
Caleb Curry
Рет қаралды 326 М.
12 Patterns for Tuning MongoDB Performance and Scalability
31:24
Lookup in Mongodb aggregation
9:47
Hitesh Choudhary
Рет қаралды 14 М.
Setup MongoDB for Production deployment - Replica Sets cluster
19:42
Découverte de Meilisearch
27:29
Grafikart.fr
Рет қаралды 17 М.
Худший продукт Apple
0:53
Rozetked
Рет қаралды 226 М.
ОБСЛУЖИЛИ САМЫЙ ГРЯЗНЫЙ ПК
1:00
VA-PC
Рет қаралды 588 М.
Самый дорогой кабель Apple
0:37
Romancev768
Рет қаралды 144 М.