SlideShare a Scribd company logo
Indexing and
Performance Tuning
Tom Schreiber
Senior Consulting Engineer, MongoDB
MongoDB's unique architecture
MongoDB's unique architecture
Indexes are the single biggest tunable
performance factor in MongoDB
Mail from a German customer after a MongoDB Performance Tuning Consulting:
MongoDB's unique architecture
{'a':	3,	
	'b':	20}
{'b':	30}
{'b':	40,	
	'a':	1	}
{'a':	9,	
	'b':	4,	
	'a':	7}
{'a':	1,	
	'b':	20}
{'a':	11} {'a':	17}
{'a':	5,	
	'b':	80}
# documents scanned:
1
db.test.find({a:5})
Full collection scan
🔍
{'a':	3,	
	'b':	20}
{'b':	30}
{'b':	40,	
	'a':	1	}
{'a':	9,	
	'b':	4,	
	'a':	7}
{'a':	1,	
	'b':	20}
{'a':	11} {'a':	17}
{'a':	5,	
	'b':	80}
🔍
db.test.find({a:5}) # documents scanned:
2
Full collection scan
{'a':	3,	
	'b':	20}
{'b':	30}
{'b':	40,	
	'a':	1	}
{'a':	9,	
	'b':	4,	
	'a':	7}
{'a':	1,	
	'b':	20}
{'a':	11} {'a':	17}
{'a':	5,	
	'b':	80}
🔍
db.test.find({a:5}) # documents scanned:
3
Full collection scan
{'a':	3,	
	'b':	20}
{'b':	30}
{'b':	40,	
	'a':	1	}
{'a':	9,	
	'b':	4,	
	'a':	7}
{'a':	1,	
	'b':	20}
{'a':	11} {'a':	17}
{'a':	5,	
	'b':	80}
🔍
db.test.find({a:5}) # documents scanned:
4
Full collection scan
{'a':	3,	
	'b':	20}
{'b':	30}
{'b':	40,	
	'a':	1	}
{'a':	9,	
	'b':	4,	
	'a':	7}
{'a':	1,	
	'b':	20}
{'a':	11} {'a':	17}
{'a':	5,	
	'b':	80}
🔍
db.test.find({a:5}) # documents scanned:
5
Full collection scan
{'a':	3,	
	'b':	20}
{'b':	30}
{'b':	40,	
	'a':	1	}
{'a':	9,	
	'b':	4,	
	'a':	7}
{'a':	1,	
	'b':	20}
{'a':	11} {'a':	17}
{'a':	5,	
	'b':	80}
🔍
db.test.find({a:5}) # documents scanned:
6
Full collection scan
{'a':	3,	
	'b':	20}
{'b':	30}
{'b':	40,	
	'a':	1	}
{'a':	9,	
	'b':	4,	
	'a':	7}
{'a':	1,	
	'b':	20}
{'a':	11} {'a':	17}
{'a':	5,	
	'b':	80}
🔍
db.test.find({a:5}) # documents scanned:
7
Full collection scan
{'a':	3,	
	'b':	20}
{'b':	30}
{'b':	40,	
	'a':	1	}
{'a':	9,	
	'b':	4,	
	'a':	7}
{'a':	1,	
	'b':	20}
{'a':	11} {'a':	17}
{'a':	5,	
	'b':	80}
🔍Time Complexity for searching in a list with n entries: O(n)
db.test.find({a:5}) # documents scanned:
8
Full collection scan
{'a':	3,	
	'b':	20}
{'b':	30}
{'b':	40,	
	'a':	1	}
{'a':	9,	
	'b':	4,	
	'a':	7}
{'a':	1,	
	'b':	20}
{'a':	11} {'a':	17}
{'a':	5,	
	'b':	80}
1 5 179
7
113
Index on 'a'
Index scan
Indexes are the single biggest tu
{'a':	3,	
	'b':	20}
{'b':	30}
{'b':	40,	
	'a':	1	}
{'a':	9,	
	'b':	4,	
	'a':	7}
{'a':	1,	
	'b':	20}
{'a':	11} {'a':	17}
{'a':	5,	
	'b':	80}
1 5 179
7
113
Index on 'a'
Search for document(s) with 'a':	5
🔍
db.test.find({a:5})
# index entries scanned: 1
Index scan
Indexes are the single biggest tu
{'a':	3,	
	'b':	20}
{'b':	30}
{'b':	40,	
	'a':	1	}
{'a':	9,	
	'b':	4,	
	'a':	7}
{'a':	1,	
	'b':	20}
{'a':	11} {'a':	17}
{'a':	5,	
	'b':	80}
1 5 179
7
113
Index on 'a'
Search for document(s) with 'a':	5
🔍
db.test.find({a:5})
# index entries scanned: 2
Index scan
Indexes are the single biggest tu
{'a':	3,	
	'b':	20}
{'b':	30}
{'b':	40,	
	'a':	1	}
{'a':	9,	
	'b':	4,	
	'a':	7}
{'a':	1,	
	'b':	20}
{'a':	11} {'a':	17}
{'a':	5,	
	'b':	80}
1 5 179
7
113
Index on 'a'
Search for document(s) with 'a':	5
🔍
db.test.find({a:5})
# index entries scanned: 3
Index scan
{'a':	3,	
	'b':	20}
{'b':	30}
{'b':	40,	
	'a':	1	}
{'a':	9,	
	'b':	4,	
	'a':	7}
{'a':	1,	
	'b':	20}
{'a':	11} {'a':	17}
{'a':	5,	
	'b':	80}
1 5 179
7
113
Index on 'a'
🔍
db.test.find({a:5})
# documents scanned: 1
# index entries scanned: 3
Time Complexity for
searching in a binary
search tree with n nodes:
O(log2	n)
log2	10.000	=	13
log2	100.000	=	16
log2	1.000.000	=	19
Index scan
MongoDB Indexes are B-Trees
[-∞, 5) [5,	10) [10,	∞)	
[5, 7) [7,	9) [9,	10)	 [10, ∞)	buckets[-∞, 5)	buckets
{...} {...} {...} {...} {...} {...} {...} {...} {...}
Index on a
Searches, Insertions, and Deletions in logarithmic time.
Index	monitoring
tresult
The Query Optimizer
Chooses the most efficient query plan.
Information on query plans

and their execution statistics:
db.col.query.explain()
full collection scan
index on x
index on y
t0
Choose and Remenber
Terminate
db.col.query(...)
stage
plan root
stage stage
stage
stage stage
Leaf nodes access the collections or the indices.
The	explain	results	present	the	query	plans	as	a	tree	of	stages.
Each	stage	passes	its	results	(i.e.	documents	or	index	keys)	to	the	parent	node.
The	internal	nodes	manipulate		
the	documents	or	the		
index	keys	that	result		
from	the	child	nodes.
The	root	node	is	the	final	stage	from	
which	MongoDB	derives	the	result	set.
db.col.query.explain()
db.test.find({a:5}).explain()
{	
		"queryPlanner"	:	{	
				[...],	
				"winningPlan"	:	{	
						"stage"	:	"FETCH",	
						"inputStage"	:	{	
								"stage"	:	"IXSCAN",	
								"keyPattern"	:	{	
										"a"	:	5	
								},	
								"indexName"	:	"a_1",	
								"isMultiKey"	:	false,	
								"direction"	:	"forward",	
								"indexBounds"	:	{	
										"a"	:	[	
												"[5.0,	5.0]"	
										]	
								}	
						}	
				}	
		},	
		[...]	
}	
plan root
stage
FETCH
stage
IXSCAN
db.test.find({a:5}).explain()
{	
		"queryPlanner"	:	{	
				[...],	
				"winningPlan"	:	{	
						"stage"	:	"FETCH",	
						"inputStage"	:	{	
								"stage"	:	"IXSCAN",	
								"keyPattern"	:	{	
										"a"	:	5	
								},	
								"indexName"	:	"a_1",	
								"isMultiKey"	:	false,	
								"direction"	:	"forward",	
								"indexBounds"	:	{	
										"a"	:	[	
												"[5.0,	5.0]"	
										]	
								}	
						}	
				}	
		},	
		[...]	
}	
stage
FETCH
[-∞, 5) [5,	10) [10,	∞)	
[5, 7) [7,	9) [9,	10)	 [10, ∞)	buckets[-∞, 5)	buckets
{...} {...} {...} {...} {...} {...} {...} {...} {...}
Index on {a:1}
plan root
stage
IXSCAN
Explain Levels
queryPlanner
"Which plan will MongoDB choose to run my query?"
executionStats
"How is my query performing?"
allPlansExecution
"I want as much information as possible to diagnose a slow query."
db.test.find({a:5}).explain()
stage
FETCH
[-∞, 5) [5,	10) [10,	∞)	
[5, 7) [7,	9) [9,	10)	 [10, ∞)	buckets[-∞, 5)	buckets
{...} {...} {...} {...} {...} {...} {...} {...} {...}
Index on {a:1}
plan root
stage
IXSCAN
{

[...],

"executionStats"	:	{



		"executionSuccess"	:	true,

		"nReturned"	:	1,

		"executionTimeMillis"	:	0,

		"totalKeysExamined"	:	1,

		"totalDocsExamined"	:	1,

		

		"executionStages"	:	{

				

				"stage"	:	"FETCH",

				"nReturned"	:	1,

				"executionTime	
					MillisEstimate"	:	0,

				"works"	:	2,

				"advanced"	:	1,

				"needTime"	:	0,

				"needFetch"	:	0,

				"saveState"	:	0,

				"restoreState"	:	0,

				"isEOF"	:	1,

				"invalidates"	:	0,

				"docsExamined"	:	1,

				"alreadyHasObj"	:	0,

				

				"inputStage"	:	{

				

						"stage"	:	"IXSCAN",

db.test.find({a:5}).explain("executionStats")
stage
FETCH
[-∞, 5) [5,	10) [10,	∞)	
[5, 7) [7,	9) [9,	10)	 [10, ∞)	buckets[-∞, 5)	buckets
{...} {...} {...} {...} {...} {...} {...} {...} {...}
Index on {a:1}
plan root
stage
IXSCAN
"executionTimeMillis"	:	0,

		"totalKeysExamined"	:	1,

		"totalDocsExamined"	:	1,

		

		"executionStages"	:	{

				

				"stage"	:	"FETCH",

				"nReturned"	:	1,

				"executionTime	
					MillisEstimate"	:	0,

				"works"	:	2,

				"advanced"	:	1,

				"needTime"	:	0,

				"needFetch"	:	0,

				"saveState"	:	0,

				"restoreState"	:	0,

				"isEOF"	:	1,

				"invalidates"	:	0,

				"docsExamined"	:	1,

				"alreadyHasObj"	:	0,

				

				"inputStage"	:	{

				

						"stage"	:	"IXSCAN",

						"nReturned"	:	1,

						"executionTime	
							MillisEstimate"	:	0,

						"works"	:	1,

						"advanced"	:	1,

						"needTime"	:	0,

						"needFetch"	:	0,

						"saveState"	:	0,

						"restoreState"	:	0,

						"isEOF"	:	1,

db.test.find({a:5}).explain("executionStats")
stage
FETCH
[-∞, 5) [5,	10) [10,	∞)	
[5, 7) [7,	9) [9,	10)	 [10, ∞)	buckets[-∞, 5)	buckets
{...} {...} {...} {...} {...} {...} {...} {...} {...}
Index on {a:1}
plan root
stage
IXSCAN
"invalidates"	:	0,

				"docsExamined"	:	1,

				"alreadyHasObj"	:	0,

				

				"inputStage"	:	{

				

						"stage"	:	"IXSCAN",

						"nReturned"	:	1,

						"executionTime	
							MillisEstimate"	:	0,

						"works"	:	1,

						"advanced"	:	1,

						"needTime"	:	0,

						"needFetch"	:	0,

						"saveState"	:	0,

						"restoreState"	:	0,

						"isEOF"	:	1,

						"invalidates"	:	0,

						"keyPattern"	:	{

								"a"	:	5

						},

						"indexName"	:	"a_1",

						"isMultiKey"	:	false,

						"direction"	:	"forward",

						"indexBounds"	:	{

								"a"	:	[

										"[5.0,			5.0]"

								]

						},

						"keysExamined"	:	1,

						"dupsTested"	:	0,

						"dupsDropped"	:	0,

						"seenInvalidated"	:	0,

						"matchTested"	:	0

db.test.find({a:5}).explain("executionStats")
stage
FETCH
[-∞, 5) [5,	10) [10,	∞)	
[5, 7) [7,	9) [9,	10)	 [10, ∞)	buckets[-∞, 5)	buckets
{...} {...} {...} {...} {...} {...} {...} {...} {...}
Index on {a:1}
plan root
stage
IXSCAN
{

[...],

"executionStats"	:	{



		"executionSuccess"	:	true,

		"nReturned"	:	1,

		"executionTimeMillis"	:	0,

		"totalKeysExamined"	:	1,

		"totalDocsExamined"	:	1,

		

		"executionStages"	:	{

				

				"stage"	:	"FETCH",

				"nReturned"	:	1,

				"executionTime	
					MillisEstimate"	:	0,

				"works"	:	2,

				"advanced"	:	1,

				"needTime"	:	0,

				"needFetch"	:	0,

				"saveState"	:	0,

				"restoreState"	:	0,

				"isEOF"	:	1,

				"invalidates"	:	0,

				"docsExamined"	:	1,

				"alreadyHasObj"	:	0,

				

				"inputStage"	:	{

				

						"stage"	:	"IXSCAN",

db.test.find({a:5}).explain("executionStats")
stage
FETCH
[-∞, 5) [5,	10) [10,	∞)	
[5, 7) [7,	9) [9,	10)	 [10, ∞)	buckets[-∞, 5)	buckets
{...} {...} {...} {...} {...} {...} {...} {...} {...}
Index on {a:1}
plan root
stage
IXSCAN
{

[...],

"executionStats"	:	{



		"executionSuccess"	:	true,

		"nReturned"	:	1,

		"executionTimeMillis"	:	0,

		"totalKeysExamined"	:	1,

		"totalDocsExamined"	:	1,

		

		"executionStages"	:	{

				

				"stage"	:	"FETCH",

				"nReturned"	:	1,

				"executionTime	
					MillisEstimate"	:	0,

				"works"	:	2,

				"advanced"	:	1,

				"needTime"	:	0,

				"needFetch"	:	0,

				"saveState"	:	0,

				"restoreState"	:	0,

				"isEOF"	:	1,

				"invalidates"	:	0,

				"docsExamined"	:	1,

				"alreadyHasObj"	:	0,

				

				"inputStage"	:	{

				

						"stage"	:	"IXSCAN",

Explain() method key metrics
[-∞, 5) [5,	10) [10,	∞)	
[5, 7) [7,	9) [9,	10)	 [10, ∞)	buckets[-∞, 5)	buckets
{...} {...} {...} {...} {...} {...} {...} {...} {...}
Index on {a:1}
{

[...],

"executionStats"	:	{



		"executionSuccess"	:	true,

		"nReturned"	:	1,

		"executionTimeMillis"	:	0,

		"totalKeysExamined"	:	1,

		"totalDocsExamined"	:	1,

		

		"executionStages"	:	{

				

				"stage"	:	"FETCH",

				"nReturned"	:	1,

				"executionTime	
					MillisEstimate"	:	0,

				"works"	:	2,

				"advanced"	:	1,

				"needTime"	:	0,

				"needFetch"	:	0,

				"saveState"	:	0,

				"restoreState"	:	0,

				"isEOF"	:	1,

				"invalidates"	:	0,

				"docsExamined"	:	1,

				"alreadyHasObj"	:	0,

				

				"inputStage"	:	{

				

						"stage"	:	"IXSCAN",

[-∞, 5) [5,	10) [10,	∞)	
[5, 7) [7,	9) [9,	10)	 [10, ∞)	buckets[-∞, 5)	buckets
{...} {...} {...} {...} {...} {...} {...} {...} {...}
Index on {a:1}
Explain() method key metrics
"nReturned"	:	1
"executionTimeMillis"	:	0
"totalKeysExamined"	:	1
"totalDocsExamined"	:	1
# documents returned
How long did the query take
# index entries scanned
# documents scanned
Index used? Which one?
				"docsExamined"	:	1,

				"alreadyHasObj"	:	0,

				

				"inputStage"	:	{

				

						"stage"	:	"IXSCAN",

						"nReturned"	:	1,

						"executionTime	
							MillisEstimate"	:	0,

						"works"	:	1,

						"advanced"	:	1,

						"needTime"	:	0,

						"needFetch"	:	0,

						"saveState"	:	0,

						"restoreState"	:	0,

						"isEOF"	:	1,

						"invalidates"	:	0,

						"keyPattern"	:	{

								"a"	:	5

						},

						"indexName"	:	"a_1",

						"isMultiKey"	:	false,

						"direction"	:	"forward",

						"indexBounds"	:	{

								"a"	:	[

										"[5.0,			5.0]"

								]

						},

						"keysExamined"	:	1,

						"dupsTested"	:	0,

						"dupsDropped"	:	0,

						"seenInvalidated"	:	0,

						"matchTested"	:	0

				}

Explain() method key metrics
"IXSCAN"
"indexName"	:	"a_1"
[-∞, 5) [5,	10) [10,	∞)	
[5, 7) [7,	9) [9,	10)	 [10, ∞)	buckets[-∞, 5)	buckets
{...} {...} {...} {...} {...} {...} {...} {...} {...}
Index on {a:1}
# documents returned
How long did the query take
# index entries scanned
# documents scanned
Performance	Tuning	
with	Indexes
Sample Data
db.zips.find() zips.json
{ "zip" : "01001", "city" : "AGAWAM", "loc" : [ -72.622739, 42.070206 ], "pop" : 15338, "state" : "MA" }
{ "zip" : "01002", "city" : "CUSHMAN", "loc" : [ -72.51564999999999, 42.377017 ], "pop" : 36963, "state" : "MA" }
{ "zip" : "01005", "city" : "BARRE", "loc" : [ -72.10835400000001, 42.409698 ], "pop" : 4546, "state" : "MA" }
{ "zip" : "01007", "city" : "BELCHERTOWN", "loc" : [ -72.41095300000001, 42.275103 ], "pop" : 10579, "state" : "MA" }
{ "zip" : "01008", "city" : "BLANDFORD", "loc" : [ -72.936114, 42.182949 ], "pop" : 1240, "state" : "MA" }
{ "zip" : "01010", "city" : "BRIMFIELD", "loc" : [ -72.188455, 42.116543 ], "pop" : 3706, "state" : "MA" }
{ "zip" : "01011", "city" : "CHESTER", "loc" : [ -72.988761, 42.279421 ], "pop" : 1688, "state" : "MA" }
{ "zip" : "01012", "city" : "CHESTERFIELD", "loc" : [ -72.833309, 42.38167 ], "pop" : 177, "state" : "MA" }
{ "zip" : "01013", "city" : "CHICOPEE", "loc" : [ -72.607962, 42.162046 ], "pop" : 23396, "state" : "MA" }
{ "zip" : "01020", "city" : "CHICOPEE", "loc" : [ -72.576142, 42.176443 ], "pop" : 31495, "state" : "MA" }
{ "zip" : "01022", "city" : "WESTOVER AFB", "loc" : [ -72.558657, 42.196672 ], "pop" : 1764, "state" : "MA" }
{ "zip" : "01026", "city" : "CUMMINGTON", "loc" : [ -72.905767, 42.435296 ], "pop" : 1484, "state" : "MA" }
{ "zip" : "01027", "city" : "MOUNT TOM", "loc" : [ -72.67992099999999, 42.264319 ], "pop" : 16864, "state" : "MA" }
{ "zip" : "01028", "city" : "EAST LONGMEADOW", "loc" : [ -72.505565, 42.067203 ], "pop" : 13367, "state" : "MA" }
{ "zip" : "01030", "city" : "FEEDING HILLS", "loc" : [ -72.675077, 42.07182 ], "pop" : 11985, "state" : "MA" }
{ "zip" : "01031", "city" : "GILBERTVILLE", "loc" : [ -72.19858499999999, 42.332194 ], "pop" : 2385, "state" : "MA" }
{ "zip" : "01032", "city" : "GOSHEN", "loc" : [ -72.844092, 42.466234 ], "pop" : 122, "state" : "MA" }
{ "zip" : "01033", "city" : "GRANBY", "loc" : [ -72.52000099999999, 42.255704 ], "pop" : 5526, "state" : "MA" }
{ "zip" : "01034", "city" : "TOLLAND", "loc" : [ -72.908793, 42.070234 ], "pop" : 1652, "state" : "MA" }
{ "zip" : "01035", "city" : "HADLEY", "loc" : [ -72.571499, 42.36062 ], "pop" : 4231, "state" : "MA" }
{ "zip" : "01036", "city" : "HAMPDEN", "loc" : [ -72.43182299999999, 42.064756 ], "pop" : 4709, "state" : "MA" }
{ "zip" : "01038", "city" : "HATFIELD", "loc" : [ -72.61673500000001, 42.38439 ], "pop" : 3184, "state" : "MA" }
{ "zip" : "01039", "city" : "HAYDENVILLE", "loc" : [ -72.70317799999999, 42.381799 ], "pop" : 1387, "state" : "MA" }
{ "zip" : "01040", "city" : "HOLYOKE", "loc" : [ -72.626193, 42.202007 ], "pop" : 43704, "state" : "MA" }
{ "zip" : "01050", "city" : "HUNTINGTON", "loc" : [ -72.873341, 42.265301 ], "pop" : 2084, "state" : "MA" }
{ "zip" : "01053", "city" : "LEEDS", "loc" : [ -72.70340299999999, 42.354292 ], "pop" : 1350, "state" : "MA" }
{ "zip" : "01054", "city" : "LEVERETT", "loc" : [ -72.499334, 42.46823 ], "pop" : 1748, "state" : "MA" }
{ "zip" : "01056", "city" : "LUDLOW", "loc" : [ -72.471012, 42.172823 ], "pop" : 18820, "state" : "MA" }
{ "zip" : "01057", "city" : "MONSON", "loc" : [ -72.31963399999999, 42.101017 ], "pop" : 8194, "state" : "MA" }
{ "zip" : "01060", "city" : "FLORENCE", "loc" : [ -72.654245, 42.324662 ], "pop" : 27939, "state" : "MA" }
{ "zip" : "01068", "city" : "OAKHAM", "loc" : [ -72.051265, 42.348033 ], "pop" : 1503, "state" : "MA" }
{ "zip" : "01069", "city" : "PALMER", "loc" : [ -72.328785, 42.176233 ], "pop" : 9778, "state" : "MA" }
{ "zip" : "01070", "city" : "PLAINFIELD", "loc" : [ -72.918289, 42.514393 ], "pop" : 571, "state" : "MA" }
{ "zip" : "01071", "city" : "RUSSELL", "loc" : [ -72.840343, 42.147063 ], "pop" : 608, "state" : "MA" }
{ "zip" : "01072", "city" : "SHUTESBURY", "loc" : [ -72.421342, 42.481968 ], "pop" : 1533, "state" : "MA" }
{ "zip" : "01073", "city" : "SOUTHAMPTON", "loc" : [ -72.719381, 42.224697 ], "pop" : 4478, "state" : "MA" }
{ "zip" : "01075", "city" : "SOUTH HADLEY", "loc" : [ -72.581137, 42.237537 ], "pop" : 16699, "state" : "MA" }
29353 documents
Question
Zip codes in New York City with population more than
100,000 ordered by population in descending order
db.zips.find({state:'NY',city:'NEW	YORK',pop:{'$gt':100000}})	
							.sort({pop:-1})
{"zip"	:	"10021",	"city"	:	"NEW	YORK",	"pop"	:	106564,	"state"	:	"NY"	}	
{"zip"	:	"10025",	"city"	:	"NEW	YORK",	"pop"	:	100027,	"state"	:	"NY"	}
{ "zip" : "01256", "city" : "SAVOY", "loc" : [ -73.023281, 42.576964 ], "pop" : 632, "state" : "MA" }
{ "zip" : "01257", "city" : "SHEFFIELD", "loc" : [ -73.361091, 42.100102 ], "pop" : 1839, "state" : "MA" }
{ "zip" : "01258", "city" : "SOUTH EGREMONT", "loc" : [ -73.456575, 42.101153 ], "pop" : 135, "state" : "MA" }
{ "zip" : "01259", "city" : "SOUTHFIELD", "loc" : [ -73.26093299999999, 42.078014 ], "pop" : 622, "state" : "MA" }
{ "zip" : "01262", "city" : "STOCKBRIDGE", "loc" : [ -73.32226300000001, 42.30104 ], "pop" : 2200, "state" : "MA" }
{ "zip" : "01266", "city" : "WEST STOCKBRIDGE", "loc" : [ -73.38251, 42.334752 ], "pop" : 1173, "state" : "MA" }
{ "zip" : "01267", "city" : "WILLIAMSTOWN", "loc" : [ -73.20363999999999, 42.708883 ], "pop" : 8220, "state" : "MA" }
{ "zip" : "01270", "city" : "WINDSOR", "loc" : [ -73.04661, 42.509494 ], "pop" : 770, "state" : "MA" }
{ "zip" : "01301", "city" : "LEYDEN", "loc" : [ -72.60184700000001, 42.601222 ], "pop" : 18968, "state" : "MA" }
{ "zip" : "01330", "city" : "ASHFIELD", "loc" : [ -72.810998, 42.523207 ], "pop" : 1535, "state" : "MA" }
{ "zip" : "01331", "city" : "NEW SALEM", "loc" : [ -72.21464400000001, 42.592065 ], "pop" : 14077, "state" : "MA" }
{ "zip" : "01337", "city" : "LEYDEN", "loc" : [ -72.563439, 42.683784 ], "pop" : 2426, "state" : "MA" }
db.zips.find({state:'NY',city:'NEW	YORK',pop:{'$gt':100000}})	
							.sort({pop:-1})
Query Plan and Execution Statistics
.explain("executionStats")
plan root
{	
		"queryPlanner"	:	{	
						"winningPlan"	:	{	
						"stage"	:	"SORT",	
						"sortPattern"	:	{	
								"pop"	:	-1	
						},	
						"inputStage"	:	{	
								"stage"	:	"COLLSCAN",	
								"filter"	:	{	
										"$and"	:	[	
												{	
														"city"	:	{	
																"$eq"	:	"NEW	YORK"	
														}	
												},	
												{	
														"state"	:	{	
																"$eq"	:	"NY"	
														}
db.zips.find({state:'NY',city:'NEW	YORK',pop:{'$gt':100000}})	
							.sort({pop:-1}).explain("executionStats")
plan root
SORT
Query Plan and Execution Statistics
{	
		"queryPlanner"	:	{	
						"winningPlan"	:	{	
						"stage"	:	"SORT",	
						"sortPattern"	:	{	
								"pop"	:	-1	
						},	
						"inputStage"	:	{	
								"stage"	:	"COLLSCAN",	
								"filter"	:	{	
										"$and"	:	[	
												{	
														"city"	:	{	
																"$eq"	:	"NEW	YORK"	
														}	
												},	
												{	
														"state"	:	{	
																"$eq"	:	"NY"	
														}
{	
		"queryPlanner"	:	{	
						"winningPlan"	:	{	
						"stage"	:	"SORT",	
						"sortPattern"	:	{	
								"pop"	:	-1	
						},	
						"inputStage"	:	{	
								"stage"	:	"COLLSCAN",	
								"filter"	:	{	
										"$and"	:	[	
												{	
														"city"	:	{	
																"$eq"	:	"NEW	YORK"	
														}	
												},	
												{	
														"state"	:	{	
																"$eq"	:	"NY"	
														}	
db.zips.find({state:'NY',city:'NEW	YORK',pop:{'$gt':100000}})	
							.sort({pop:-1}).explain("executionStats")
plan root
SORT
COLLSCAN {...} {...} {...} {...} {...} {...} {...} {...} {...}
Collection Scan!
Query Plan and Execution Statistics
}	
												},	
												{	
														"pop"	:	{	
																"$gt"	:	100000	
														}	
												}	
										]	
								},	
								"direction"	:	"forward"	
						}	
				},	
				"rejectedPlans"	:	[	]	
		},	
		"executionStats"	:	{	
				"executionSuccess"	:	true,	
				"nReturned"	:	2,	
				"executionTimeMillis"	:	15,	
				"totalKeysExamined"	:	0,	
				"totalDocsExamined"	:	29353,	
				"executionStages"	:	{	
						"stage"	:	"SORT",	
						"nReturned"	:	2,	
						"executionTimeMillisEstimate"	:	0,	
						"works"	:	29359,	
						"advanced"	:	2,	
						"needTime"	:	29355,	
						"needFetch"	:	0,	
						"saveState"	:	229,	
						"restoreState"	:	229,	
						"isEOF"	:	1,	
						"invalidates"	:	0,	
						"sortPattern"	:	{	
								"pop"	:	-1	
.explain("executionStats")
{...} {...} {...} {...} {...} {...} {...} {...} {...}
2 documents returned
29353 documents scanned
plan root
SORT
COLLSCAN
In-Memory Sort!
db.zips.find({state:'NY',city:'NEW	YORK',pop:{'$gt':100000}})	
							.sort({pop:-1})
Query Plan and Execution Statistics
Collection Scan!
db.zips.find({state:'NY',city:'NEW	YORK',pop:{'$gt':100000}})	
							.sort({pop:-1}).explain("executionStats")
Single Field Index
db.zips.createIndex({state:1})
{	
		"queryPlanner":	{	
				"winningPlan":	{	
						"stage":	"SORT",	
						"sortPattern":	{	
								"pop":	-1	
						},	
						"inputStage":	{	
								"stage":	"FETCH",	
								"filter":	{	
										"$and":	[	
												{	
														"city":	{	
																"$eq":	"NEW	YORK"	
														}	
												},	
												{	
														"pop":	{	
																"$gt":	100000	
														}	
plan root
SORT
{	
		"queryPlanner":	{	
				"winningPlan":	{	
						"stage":	"SORT",	
						"sortPattern":	{	
								"pop":	-1	
						},	
						"inputStage":	{	
								"stage":	"FETCH",	
								"filter":	{	
										"$and":	[	
												{	
														"city":	{	
																"$eq":	"NEW	YORK"	
														}	
												},	
												{	
														"pop":	{	
																"$gt":	100000	
														}	
db.zips.find({state:'NY',city:'NEW	YORK',pop:{'$gt':100000}})	
							.sort({pop:-1}).explain("executionStats")
Single Field Index
db.zips.createIndex({state:1})
plan root
SORT
FETCH
"pop":	-1	
						},	
						"inputStage":	{	
								"stage":	"FETCH",	
								"filter":	{	
										"$and":	[	
												{	
														"city":	{	
																"$eq":	"NEW	YORK"	
														}	
												},	
												{	
														"pop":	{	
																"$gt":	100000	
														}	
												}	
										]	
								},	
								"inputStage":	{	
										"stage":	"IXSCAN",	
										"keyPattern":	{	
												"state":	1	
										},	
										"indexName":	"state_1",	
										"isMultiKey":	false,	
										"direction":	"forward",	
										"indexBounds":	{	
												"state":	[	
														"["NY",	"NY"]"	
												]	
										}	
								}	
						}	
				},	
db.zips.find({state:'NY',city:'NEW	YORK',pop:{'$gt':100000}})	
							.sort({pop:-1}).explain("executionStats")
Single Field Index
db.zips.createIndex({state:1})
plan root
SORT
FETCH
IXSCAN
{...} {...} {...} {...} {...} {...} {...} {...} {...}
},	
										"indexName":	"state_1",	
										"isMultiKey":	false,	
										"direction":	"forward",	
										"indexBounds":	{	
												"state":	[	
														"["NY",	"NY"]"	
												]	
										}	
								}	
						}	
				},	
				"rejectedPlans":	[]	
		},	
		"executionStats":	{	
				"executionSuccess":	true,	
				"nReturned":	2,	
				"executionTimeMillis":	6,	
				"totalKeysExamined":	1595,	
				"totalDocsExamined":	1595,	
				"executionStages":	{	
						"stage":	"SORT",	
						"nReturned":	2,	
						"executionTimeMillisEstimate":	0,	
						"works":	1600,	
						"advanced":	2,	
						"needTime":	1596,	
						"needFetch":	0,	
						"saveState":	12,	
						"restoreState":	12,	
						"isEOF":	1,	
						"invalidates":	0,	
						"sortPattern":	{	
								"pop":	-1	
db.zips.find({state:'NY',city:'NEW	YORK',pop:{'$gt':100000}})	
							.sort({pop:-1}).explain("executionStats")
Single Field Index
db.zips.createIndex({state:1})
plan root
SORT
FETCH
IXSCAN
2 documents returned
1595 documents scanned
1595 index entries scanned
In-Memory Sort!
{...} {...} {...} {...} {...} {...} {...} {...} {...}
{

		"queryPlanner":	{

				"winningPlan":	{

						"stage":	"SORT",

						"sortPattern":	{

								"pop":	-1

						},

						"inputStage":	{

								"stage":	"FETCH",

								"filter":	{

										"pop":	{

												"$gt":	100000

										}

								},

								"inputStage":	{

										"stage":	"IXSCAN",

										"keyPattern":	{

												"state":	1,

												"city":	1

										},

db.zips.createIndex({state:1,	city:1})
Compound Index on two fields
plan root
SORT
FETCH
IXSCAN
{...} {...} {...} {...} {...} {...} {...} {...} {...}
db.zips.find({state:'NY',city:'NEW	YORK',pop:{'$gt':100000}})	
							.sort({pop:-1}).explain("executionStats")
{

		"queryPlanner":	{

				"winningPlan":	{

						"stage":	"SORT",

						"sortPattern":	{

								"pop":	-1

						},

						"inputStage":	{

								"stage":	"FETCH",

								"filter":	{

										"pop":	{

												"$gt":	100000

										}

								},

								"inputStage":	{

										"stage":	"IXSCAN",

										"keyPattern":	{

												"state":	1,

												"city":	1

										},

										"indexName":	"state_1_city_1",

										"isMultiKey":	false,

										"direction":	"forward",

										"indexBounds":	{

												"state":	[

														"["NY",	"NY"]"

												],

												"city":	[

														"["NEW	YORK",	"NEW	YORK
"]"

												]

										}

								}

						}

db.zips.find({state:'NY',city:'NEW	YORK',pop:{'$gt':100000}})	
							.sort({pop:-1}).explain("executionStats")
db.zips.createIndex({state:1,	city:1})
Compound Index on two fields
plan root
SORT
FETCH
IXSCAN
{...} {...} {...} {...} {...} {...} {...} {...} {...}
"direction":	"forward",

										"indexBounds":	{

												"state":	[

														"["NY",	"NY"]"

												],

												"city":	[

														"["NEW	YORK",	"NEW	YORK
"]"

												]

										}

								}

						}

				}

		},

		"executionStats":	{

				"executionSuccess":	true,

				"nReturned":	2,

				"executionTimeMillis":	4,

				"totalKeysExamined":	40,

				"totalDocsExamined":	40,

				"executionStages":	{

						"stage":	"SORT",

						"nReturned":	2,

						"executionTimeMillisEstimate":	4,

						"works":	45,

						"advanced":	2,

						"needTime":	41,

						"needFetch":	0,

						"saveState":	0,

						"restoreState":	0,

						"isEOF":	1,

						"invalidates":	0,

						"sortPattern":	{

								"pop":	-1

db.zips.find({state:'NY',city:'NEW	YORK',pop:{'$gt':100000}})	
							.sort({pop:-1}).explain("executionStats")
db.zips.createIndex({state:1,	city:1})
Compound Index on two fields
plan root
SORT
FETCH
IXSCAN
{...} {...} {...} {...} {...} {...} {...} {...} {...}
2 documents returned
40 documents scanned
40 index entries scanned
In-Memory Sort!
{

		"queryPlanner":	{

				"winningPlan":	{

						"stage":	"FETCH",

						"inputStage":	{

								"stage":	"IXSCAN",

								"keyPattern":	{

										"state":	1,

										"city":	1,

										"pop":	1

								},

								"indexName":	"state_1_city_1_pop_1",

								"isMultiKey":	false,

								"direction":	"backward",

								"indexBounds":	{

										"state":	[

												"["NY",	"NY"]"

										],

										"city":	[

												"["NEW	YORK",	"NEW	YORK"]"

IXSCAN
FETCH
db.zips.find({state:'NY',city:'NEW	YORK',pop:{'$gt':100000}})	
							.sort({pop:-1}).explain("executionStats")
db.zips.createIndex({state:1,city:1,pop:1})
Compound Index on three fields
plan root
{...} {...} {...} {...} {...} {...} {...} {...} {...}
"indexBounds":	{

										"state":	[

												"["NY",	"NY"]"

										],

										"city":	[

												"["NEW	YORK",	"NEW	YORK"]"

										],

										"pop":	[

												"[inf.0,	100000.0)"

										]

								}

						}

				}

		},

		"executionStats":	{

				"executionSuccess":	true,

				"nReturned":	2,

				"executionTimeMillis":	2,

				"totalKeysExamined":	2,

				"totalDocsExamined":	2,

				"executionStages":	{

						"stage":	"FETCH",

						"nReturned":	2,

						"executionTimeMillisEstimate":	1,

						"works":	3,

						"advanced":	2,

						"needTime":	0,

						"needFetch":	0,

						"saveState":	0,

						"restoreState":	0,

						"isEOF":	1,

						"invalidates":	0,

						"docsExamined":	2,

						"alreadyHasObj":	0,

IXSCAN
FETCH
db.zips.find({state:'NY',city:'NEW	YORK',pop:{'$gt':100000}})	
							.sort({pop:-1}).explain("executionStats")
db.zips.createIndex({state:1,city:1,pop:1})
Compound Index on three fields
plan root
{...} {...} {...} {...} {...} {...} {...} {...} {...}
2 documents returned
2 documents scanned
2 index entries scanned
Index used for Sorting!
db.zips.find({state:'NY',city:'NEW	YORK',pop:{'$gt':100000}})	
							.sort({pop:-1})
Projection on Index-only Data
db.zips.createIndex({state:1,city:1,pop:1})
{"zip"	:	"10021",	"city"	:	"NEW	YORK",	"pop"	:	106564,	"state"	:	"NY"	}	
{"zip"	:	"10025",	"city"	:	"NEW	YORK",	"pop"	:	100027,	"state"	:	"NY"	}
db.zips.find({state:'NY',city:'NEW	YORK',pop:{'$gt':100000}})	
							.sort({pop:-1})
Projection on Index-only Data
db.zips.createIndex({state:1,city:1,pop:1})
db.zips.find({state:'NY',city:'NEW	YORK’,pop:{‘$gt':100000}},	
													{state:1,	city:1,	pop:1})	
							.sort({pop:-1})
Projection on Index-only Data
db.zips.createIndex({state:1,city:1,pop:1})
{"state"	:	"NY",	"city"	:	"NEW	YORK",	"pop"	:	106564	}	
{"state"	:	"NY",	"city"	:	"NEW	YORK",	"pop"	:	100027	}
{	
		"queryPlanner":	{	
				"winningPlan":	{	
						"stage":	"PROJECTION",	
						"transformBy":	{	
								"state":	1,	
								"city":	1,	
								"pop":	1,	
								"zip":	0	
						},	
						"inputStage":	{	
								"stage":	"IXSCAN",	
								"keyPattern":	{	
										"state":	1,	
										"city":	1,	
										"pop":	1	
								},	
								"indexName":	"state_1_city_1_pop_1",	
db.zips.find({state:'NY',city:'NEW	YORK’,pop:{‘$gt':100000}},	
													{state:1,	city:1,	pop:1})	
							.sort({pop:-1}).explain("executionStats")
Projection on Index-only Data
db.zips.createIndex({state:1,city:1,pop:1})
IXSCAN
PROJECTION
plan root
"isMultiKey":	false,	
								"direction":	"backward",	
								"indexBounds":	{	
										"state":	[	
												"["NY",	"NY"]"	
										],	
										"city":	[	
												"["NEW	YORK",	"NEW	YORK"]"	
										],	
										"pop":	[	
												"[inf.0,	100000.0)"	
										]	
								}	
						}	
				}	
		},	
		"executionStats":	{	
				"executionSuccess":	true,	
				"nReturned":	2,	
				"executionTimeMillis":	0,	
				"totalKeysExamined":	2,	
				"totalDocsExamined":	0,	
				"executionStages":	{	
						"stage":	"PROJECTION",	
						"nReturned":	2,	
						"executionTimeMillisEstimate":	0,	
						"works":	3,	
						"advanced":	2,	
						"needTime":	0,	
						"needFetch":	0,	
						"saveState":	0,	
						"restoreState":	0,	
						"isEOF":	1,	
						"invalidates":	0,	
db.zips.find({state:'NY',city:'NEW	YORK’,pop:{‘$gt':100000}},	
													{state:1,	city:1,	pop:1})	
							.sort({pop:-1}).explain("executionStats")
Projection on Index-only Data
db.zips.createIndex({state:1,city:1,pop:1})
IXSCAN
PROJECTION
plan root 2 documents returned
0 documents scanned
2 index entries scanned
"Covered Query "
{	
		"executionStats"	:	{	
				"executionSuccess"	:	true,	
				"nReturned"	:	27757,	
				"executionTimeMillis"	:	156,	
				"totalKeysExamined"	:	27759,	
				"totalDocsExamined"	:	27757,	
				"executionStages"	:	{	
						"stage"	:	"SORT",	
						"nReturned"	:	27757,	
						"executionTimeMillisEstimate"	:	110,	
						"works"	:	55519,	
						"advanced"	:	27757,	
						"needTime"	:	27760,	
						"needFetch"	:	0,	
						"saveState"	:	433,	
Negation
db.zips.find({state:{$ne:’NY'},city:'NEW	YORK’,pop:{'$gt':100000}})	
							.sort({pop:-1})
db.zips.find({state:{$ne:’NY'},	
															city:{$ne:'NEW	YORK’},	
																pop:{$not:{‘$gt':100000}}})	
							.sort({pop:-1}).explain("executionStats")
plan root
SORT
FETCH
IXSCAN
{...} {...} {...} {...} {...} {...} {...} {...} {...}
27757 documents returned
27759 documents scanned
27757 index entries scanned
In-Memory Sort!
db.zips.createIndex({state:1,city:1,pop:1})
"alreadyHasObj"	:	0,	
					"inputStage"	:	{	
							"stage"	:	"IXSCAN",	
							"nReturned"	:	27757,	
							"executionTimeMillisEstimate"	:	40,	
							"works"	:	27759,	
							"advanced"	:	27757,	
							"needTime"	:	2,	
							"needFetch"	:	0,	
							"saveState"	:	433,	
							"restoreState"	:	433,	
							"isEOF"	:	1,	
							"invalidates"	:	0,	
							"keyPattern"	:	{	
									"state"	:	1,	
									"city"	:	1,	
									"pop"	:	1	
							},	
							"indexName"	:	"state_1_city_1_pop_1",	
							"isMultiKey"	:	false,	
							"direction"	:	"forward",	
							"indexBounds"	:	{	
									"state"	:	[	
											"[MinKey,	"NY")",	
											"("NY",	MaxKey]"	
									],	
									"city"	:	[	
											"[MinKey,	"NEW	YORK")",	
											"("NEW	YORK",	MaxKey]"	
									],	
									"pop"	:	[	
											"[MinKey,	100000.0]",	
											"(inf.0,	MaxKey]"	
									]	
db.zips.find({state:{$ne:’NY'},city:'NEW	YORK’,pop:{'$gt':100000}})	
							.sort({pop:-1})
db.zips.find({state:{$ne:’NY'},	
															city:{$ne:'NEW	YORK’},	
																pop:{$not:{‘$gt':100000}}})	
							.sort({pop:-1}).explain("executionStats")
27757 documents returned
27759 documents scanned
27757 index entries scanned
In-Memory Sort!
db.zips.createIndex({state:1,city:1,pop:1})
Negation
plan root
SORT
FETCH
IXSCAN
{...} {...} {...} {...} {...} {...} {...} {...} {...}
Memory Contention
{...} {...} {...} {...} {...} {...} {...} {...} {...}
Main Memory (RAM)
⚙mongod process
{...} {...} {...} {...} {...} {...} {...} {...} {...}
Main Memory (RAM)
⚙mongod process
Memory Contention
{...} {...} {...} {...} {...} {...} {...} {...}
Main Memory (RAM)
⚙mongod process
Memory Contention
{...} {...} {...} {...} {...} {...} {...} {...} {...}
Main Memory (RAM)
⚙mongod process
Memory Contention
Memory Contention
{...} {...} {...} {...} {...} {...} {...} {...} {...}
Main Memory (RAM)
⚙mongod process
Reduce Memory Contention
Main Memory (RAM)
{...} {...} {...} {...} {...} {...} {...} {...} {...}
db.zips.find({state:'NY',city:'NEW	YORK’,pop:{'$gt':100000}})	
							.sort({pop:-1})
db.zips.createIndex({state:1,	city:1,	pop:1})
db.zips.dropIndex({state:1,	city:1})
db.zips.dropIndex({state:1})
Remove unneeded indexes
Reduce Memory Contention
Right-Balanced Index Access
Random Index Access
The entire index is “hot”
The entire index must fit into RAM
Right-Balanced Index Access
Spatial Data Locality
Amount of Index Data in RAM
is significantly reduced
mongod	--dbpath	DBPATH	--storageEngine	wiredTiger	
							--wiredTigerIndexPrefixCompression
Reduce Memory Contention
Index compression
Prefix Compression for Indexes on disk and in RAM
Reduce Data Transfer Latency
Indexes on a separate storage device
mongod	--dbpath	DBPATH	--storageEngine	wiredTiger	
							--wiredTigerDirectoryForIndexes
One file per Collection under DBPATH/collection
One file per Index under DBPATH/collection
Indexes can be placed on a dedicated
storage device (e.g. SSD) for higher performance
There is more
Multikey Indexes
Text Indexes
Geospatial Indexes
TTL Indexes
Unique Indexes
. . .
Hash Indexes
Sparse Indexes
Sharding
Database Profiler
mongod Log Files
mongostat
mongotop
mongoperf
Cloud Manager
Schema Design
Query Patterns
There is more
Multikey Indexes
Text Indexes
Geospatial Indexes
TTL Indexes
Unique Indexes
. . .
Hash Indexes
Sparse Indexes
Sharding
Database Profiler
mongod Log Files
mongostat
mongotop
mongoperf
Cloud Manager
Schema Design
Query Patterns
Summary
Indexes are the single biggest tunable performance factor in MongoDB
Create indexes that support your queries
Create highly selective indexes
Remove unneeded indexes
Analyse your query plans with explain()
Use covered queries for maximum read performance
Negation Queries can’t benefit from indexes
Use wiredTiger feature to place indexes on high performance volumes
Go and build something humongous
ThankYou!
#MDBDays
mongodb.com
Get your technical questions answered
Foyer Royal Ballroom, 10:00 - 17:00
By appointment only – register in person in
the Foyer Royal Ballroom
MongoDB
Performance Measurement Tools
Log files, Profiler, Query Optimizer
mongod
log	file
profiler	(collection)
query	engine
mongod Log Files
Sun Jun 29 06:35:37.646 [conn2]
query test.docs query:
{ parent.company: "22794",
parent.employeeId: "83881" }
ntoreturn:1 ntoskip:0 nscanned:
806381 keyUpdates:0 numYields: 5
locks(micros) r:2145254
nreturned:0 reslen:20 1156ms
date	and	time thread
operation
namespace
n…

counters
lock

times
duration
number	of	
yields
Parsing Log Files
mtools
• http://github.com/rueckstiess/mtools
• log file analysis for poorly performing queries
– Show me queries that took more than 1000 ms from 6
am to 6 pm:
$ mlogfilter	mongodb.log	--from	06:00	--to	
18:00	--slow	1000	>	mongodb-filtered.log
mtools graphs
% mplotqueries --type histogram --group namespace --bucketSize 3600
Database Profiler
• Collect	actual	samples	from	a	running	
MongoDB	instance	
• Tunable	for	level	and	slowness	
• Can	be	controlled	dynamically
• Enable to see slow queries
– (or all queries)
– Default 100ms
Using Database profiler
// Enable database profiler on the console, 0=off 1=slow 2=all	
> db.setProfilingLevel(1, 50)	
{ "was" : 0, "slowms" : 50, "ok" : 1 }	
// View profile with 	
> show profile	
// See the raw data	
>db.system.profile.find().pretty()
Profiler
• 1MB capped collection named system.profile per database, per replica set
• One document per operation
• Examples:
> db.setProfilingLevel(1) // log all operations greater than 100ms
> db.setProfilingLevel(1, 20) // log all operations greater than 20ms
> db.setProfilingLevel(2) // log all operations regardless of duration
> db.setProfilingLevel(0) // turn off profiling
> db.getProfilingStatus() // display current profiling level
{
"slowms": 100,
"was": 2
}
• In a sharded cluster, you will need to connect to each shard's primary
mongod, not mongos
Command Line tools
• iostat
• dstat
• mongostat
• mongotop
• mongoperf
Cloud Manager
• Memory usage
• Opcounters
• Lock percentage
• Queues
• Background flush average
• Replication oplog window and lag

More Related Content

PPT
Fast querying indexing for performance (4)
PDF
Introduction to Mongodb execution plan and optimizer
PPTX
MongoDB and Indexes - MUG Denver - 20160329
PDF
MongoDB .local Toronto 2019: Tips and Tricks for Effective Indexing
PDF
MongoDB World 2019: Tips and Tricks++ for Querying and Indexing MongoDB
PDF
MongoDB Aggregation Framework
PDF
MongoDB .local Toronto 2019: Aggregation Pipeline Power++: How MongoDB 4.2 Pi...
PDF
MongoDB World 2019: The Sights (and Smells) of a Bad Query
Fast querying indexing for performance (4)
Introduction to Mongodb execution plan and optimizer
MongoDB and Indexes - MUG Denver - 20160329
MongoDB .local Toronto 2019: Tips and Tricks for Effective Indexing
MongoDB World 2019: Tips and Tricks++ for Querying and Indexing MongoDB
MongoDB Aggregation Framework
MongoDB .local Toronto 2019: Aggregation Pipeline Power++: How MongoDB 4.2 Pi...
MongoDB World 2019: The Sights (and Smells) of a Bad Query

What's hot (20)

PDF
MongoDB Performance Tuning
PPTX
Indexing with MongoDB
PPTX
MongoDB - Aggregation Pipeline
PDF
Deep Dive on ClickHouse Sharding and Replication-2202-09-22.pdf
PDF
Storing time series data with Apache Cassandra
PDF
The MySQL Query Optimizer Explained Through Optimizer Trace
PPTX
Mongo DB Presentation
PDF
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
PDF
Indexing
PDF
ClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEO
PDF
MongodB Internals
PPTX
Migration to ClickHouse. Practical guide, by Alexander Zaitsev
PPTX
The Aggregation Framework
PDF
MySQL 8.0 Optimizer Guide
PDF
ClickHouse Monitoring 101: What to monitor and how
PDF
Analytics at Speed: Introduction to ClickHouse and Common Use Cases. By Mikha...
PPTX
An Enterprise Architect's View of MongoDB
PDF
MongoDB- Crud Operation
PPTX
MongoDB Aggregation Performance
PPTX
Indexing and Query Optimization
MongoDB Performance Tuning
Indexing with MongoDB
MongoDB - Aggregation Pipeline
Deep Dive on ClickHouse Sharding and Replication-2202-09-22.pdf
Storing time series data with Apache Cassandra
The MySQL Query Optimizer Explained Through Optimizer Trace
Mongo DB Presentation
ClickHouse Data Warehouse 101: The First Billion Rows, by Alexander Zaitsev a...
Indexing
ClickHouse tips and tricks. Webinar slides. By Robert Hodges, Altinity CEO
MongodB Internals
Migration to ClickHouse. Practical guide, by Alexander Zaitsev
The Aggregation Framework
MySQL 8.0 Optimizer Guide
ClickHouse Monitoring 101: What to monitor and how
Analytics at Speed: Introduction to ClickHouse and Common Use Cases. By Mikha...
An Enterprise Architect's View of MongoDB
MongoDB- Crud Operation
MongoDB Aggregation Performance
Indexing and Query Optimization
Ad

Viewers also liked (9)

PDF
MongoDB Performance Tuning
PPTX
Performance Tuning on the Fly at CMP.LY
KEY
Indexing with MongoDB
PDF
MongoDB Days UK: Indexing and Performance Tuning
PPTX
Webinar: Index Tuning and Evaluation
PDF
MongoDB Europe 2016 - Debugging MongoDB Performance
PPTX
Indexing and Query Optimizer (Aaron Staple)
PPTX
MongoDB Performance Tuning and Monitoring
PDF
Optimizing MongoDB: Lessons Learned at Localytics
MongoDB Performance Tuning
Performance Tuning on the Fly at CMP.LY
Indexing with MongoDB
MongoDB Days UK: Indexing and Performance Tuning
Webinar: Index Tuning and Evaluation
MongoDB Europe 2016 - Debugging MongoDB Performance
Indexing and Query Optimizer (Aaron Staple)
MongoDB Performance Tuning and Monitoring
Optimizing MongoDB: Lessons Learned at Localytics
Ad

Similar to Indexing and Performance Tuning (20)

PDF
Indexing and Query Performance in MongoDB.pdf
PPTX
Query Optimization in MongoDB
PPTX
Performance Tuning and Optimization
PPTX
MongoDB's index and query optimize
PDF
Mongoseattle indexing-2010-07-27
PDF
Indexing and Query Optimizer (Richard Kreuter)
PDF
Mongophilly indexing-2011-04-26
PDF
Indexing and Query Optimizer (Mongo Austin)
PPTX
Indexing Strategies to Help You Scale
PDF
Mongo db improve the performance of your application codemotion2016
PDF
Indexing and Query Optimizer
ODP
Mongo indexes
PPTX
Indexing In MongoDB
PDF
Quick overview on mongo db
DOCX
unit 4,Indexes in database.docx
PPTX
MongoDB Aggregations Indexing and Profiling
PPT
Indexing & query optimization
PDF
Mdb dn 2016_05_index_tuning
PPTX
Indexing documents
PPTX
Automated Slow Query Analysis: Dex the Index Robot
Indexing and Query Performance in MongoDB.pdf
Query Optimization in MongoDB
Performance Tuning and Optimization
MongoDB's index and query optimize
Mongoseattle indexing-2010-07-27
Indexing and Query Optimizer (Richard Kreuter)
Mongophilly indexing-2011-04-26
Indexing and Query Optimizer (Mongo Austin)
Indexing Strategies to Help You Scale
Mongo db improve the performance of your application codemotion2016
Indexing and Query Optimizer
Mongo indexes
Indexing In MongoDB
Quick overview on mongo db
unit 4,Indexes in database.docx
MongoDB Aggregations Indexing and Profiling
Indexing & query optimization
Mdb dn 2016_05_index_tuning
Indexing documents
Automated Slow Query Analysis: Dex the Index Robot

More from MongoDB (20)

PDF
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
PDF
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
PDF
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
PDF
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
PDF
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
PDF
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
PDF
MongoDB SoCal 2020: MongoDB Atlas Jump Start
PDF
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
PDF
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
PDF
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
PDF
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
PDF
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
PDF
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
PDF
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
PDF
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
PDF
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
PDF
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
PDF
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
PDF
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
PDF
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...

Recently uploaded (20)

PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
A Presentation on Artificial Intelligence
PPT
Teaching material agriculture food technology
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
KodekX | Application Modernization Development
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
cuic standard and advanced reporting.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
Cloud computing and distributed systems.
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
A Presentation on Artificial Intelligence
Teaching material agriculture food technology
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
NewMind AI Monthly Chronicles - July 2025
Encapsulation_ Review paper, used for researhc scholars
KodekX | Application Modernization Development
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Review of recent advances in non-invasive hemoglobin estimation
20250228 LYD VKU AI Blended-Learning.pptx
Empathic Computing: Creating Shared Understanding
Unlocking AI with Model Context Protocol (MCP)
cuic standard and advanced reporting.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Cloud computing and distributed systems.
Chapter 3 Spatial Domain Image Processing.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...

Indexing and Performance Tuning