Shawn  Durgan

Shawn Durgan

1598750220

MongoDB Indexes: Deep Dive, Understanding Indexes.

Getting a performance boost with the best usage of indexes, by understanding what’s the data structure, how it works’s/stored, how is it loaded into memory. How Query optimization make’s decision to select indexes.

_Basic understanding of indexes is required i.e what are indexes, index types, creating them. _https://docs.mongodb.com/manual/indexes/

  • Data Structure
  • Storage on disk
  • Memory Allocation.

Data Structure

Index on a filed/fields is stored in order that we specify using B-Tree data structure. Stored in ordered Let see what does it mean’s and how it help’s.

  • Index is created on the value of the filed referencing to the actual document stored.

Image for post

snipped from: MognoDB university

  • Using B-Tree indexes significantly reduces the number of comparison to find the document.

Image for post

snipped from: MognoDB university

  • Likewise in below picture we can see with index(sky blue line) even adding document still limit the number of document examined in comparison to without index/collscan.

Image for post

snipped from: MognoDB university

Storage On Disk

Let’s see/visualize how the index are stored on disk. Index stored on disk is managed by the database storage engine itself.

  • Uses prefix Index compression- Repeated prefix value is not written, let us see example to understand what it mean’s.
db.getCollection("movieTicket")
.ensureIndex({"showDate":1, "seatNo":1, "status":1});

How the index ({“showDate”:1, “seatNo”:1, “status”:1}) is stored on disk.

Image for post

showDate_1_seatNo_1_status_1

#index #mongodb #indexing #mongo

What is GEEK

Buddha Community

MongoDB Indexes: Deep Dive, Understanding Indexes.
Shawn  Durgan

Shawn Durgan

1598750220

MongoDB Indexes: Deep Dive, Understanding Indexes.

Getting a performance boost with the best usage of indexes, by understanding what’s the data structure, how it works’s/stored, how is it loaded into memory. How Query optimization make’s decision to select indexes.

_Basic understanding of indexes is required i.e what are indexes, index types, creating them. _https://docs.mongodb.com/manual/indexes/

  • Data Structure
  • Storage on disk
  • Memory Allocation.

Data Structure

Index on a filed/fields is stored in order that we specify using B-Tree data structure. Stored in ordered Let see what does it mean’s and how it help’s.

  • Index is created on the value of the filed referencing to the actual document stored.

Image for post

snipped from: MognoDB university

  • Using B-Tree indexes significantly reduces the number of comparison to find the document.

Image for post

snipped from: MognoDB university

  • Likewise in below picture we can see with index(sky blue line) even adding document still limit the number of document examined in comparison to without index/collscan.

Image for post

snipped from: MognoDB university

Storage On Disk

Let’s see/visualize how the index are stored on disk. Index stored on disk is managed by the database storage engine itself.

  • Uses prefix Index compression- Repeated prefix value is not written, let us see example to understand what it mean’s.
db.getCollection("movieTicket")
.ensureIndex({"showDate":1, "seatNo":1, "status":1});

How the index ({“showDate”:1, “seatNo”:1, “status”:1}) is stored on disk.

Image for post

showDate_1_seatNo_1_status_1

#index #mongodb #indexing #mongo

Query of MongoDB | MongoDB Command | MongoDB | Asp.Net Core Mvc

https://youtu.be/FwUobnB5pv8

#mongodb tutorial #mongodb tutorial for beginners #mongodb database #mongodb with c# #mongodb with asp.net core #mongodb

Install MongoDB Database | MongoDB | Asp.Net Core Mvc

#MongoDB
#Aspdotnetexplorer

https://youtu.be/cnwNWzcw3NM

#mongodb #mongodb database #mongodb with c# #mongodb with asp.net core #mongodb tutorial for beginners #mongodb tutorial

Insert & Save method in MongoDB | Inserting Document | CRUD Operation in MongoDB

#MongoDB
#AspDotNetExplorer
https://youtu.be/CohnNdE_rjM

#mongodb #mongodb tutorial for beginners #mongodb tutorial #mongodb database #learn mongodb

Execute MongoDB Command | Create, Drop and Select Database | MongoDB | Asp.Net Core Mvc

https://youtu.be/SKpNG83X2Ig

#mongodb #mongodb with asp.net core #mongodb with c# #mongodb tutorial for beginners #mongodb tutorial #learn mognodb