[DOCS-11959] Docs for SERVER-36527: Include queryHash in explain output Created: 13/Aug/18  Updated: 13/Nov/23  Resolved: 31/Jan/19

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: 4.1.2, Server_Docs_20231030, Server_Docs_20231106, Server_Docs_20231105, Server_Docs_20231113

Type: Task Priority: Major - P3
Reporter: Kay Kim (Inactive) Assignee: Kay Kim (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
documents SERVER-36527 Include queryHash in explain output Closed
Duplicate
Related
related to DOCS-11965 Docs for SERVER-23332: Expose query p... Closed
related to DOCS-11982 Docs for SERVER-36528: Implement $pla... Closed
related to DOCS-12387 Docs for SERVER-33303: Modifying inde... Closed
is related to DOCS-11962 Docs for SERVER-35981: Include hash o... Closed
Participants:
Days since reply: 5 years, 2 weeks ago
Epic Link: DOCS: 4.2 Server/Tools

 Description   

----------------------------

Original Description

Description:

We may wish to document the new queryPlanner.queryHash field in our pages about explain output:

https://docs.mongodb.com/manual/reference/explain-results/

All queries with the same hash are considered the same "shape", and use the same plan cache entry. This may be useful for diagnosing issues around query performance. Please ask Storch for more details, and to review any proposed documentation changes.

Note that https://jira.mongodb.org/browse/SERVER-35981 added this same 'queryHash' to the plan cache introspection commands output, and https://jira.mongodb.org/browse/SERVER-23332 added it to the slow query logs and system.profile output.

Engineering Ticket Description:

In SERVER-35981 and /SERVER-35982 we have added queryHash to various query debug mechanisms, an 8 character hex string representing a 32 bit unsigned hash value. This hash can identify instances of queries that the system considers of the shape, and thus share the same plan cache entry. The intention is that this hash will help to correlate events related to the same plan cache entry, which is important for diagnosing query performance issues in which the plan cache is involved.

This ticket also tracks the work to add queryHash to the queryPlanner section of explain output. For instance, the output could look something like this for a simple query:

MongoDB Enterprise > db.c.find({a: 2}).explain()
{
	"queryPlanner" : {
		"plannerVersion" : 1,
		"namespace" : "test.c",
		"indexFilterSet" : false,
		"parsedQuery" : {
			"a" : {
				"$eq" : 2
			}
		},
		"queryHash" : "100FCEBA", // THIS IS NEW!
		"winningPlan" : {
			"stage" : "FETCH",
			"inputStage" : {
				"stage" : "IXSCAN",
				"keyPattern" : {
					"a" : 1
				},
				"indexName" : "a_1",
				"isMultiKey" : false,
				"multiKeyPaths" : {
					"a" : [ ]
				},
				"isUnique" : false,
				"isSparse" : false,
				"isPartial" : false,
				"indexVersion" : 2,
				"direction" : "forward",
				"indexBounds" : {
					"a" : [
						"[2.0, 2.0]"
					]
				}
			}
		},
		"rejectedPlans" : [ ]
	},
	"serverInfo" : {
		"host" : "storchbox",
		"port" : 27017,
		"version" : "0.0.0",
		"gitVersion" : "unknown"
	},
	"ok" : 1
}

----------------------------

Description

Scope of changes (files that need work and how much)

  • reference/explain-results
  • tutorial/analyze-query-plan (this page is more index v no-index and which index is better)
  • core/query-plans
  • core/query-optimization (this page is more create indexes that support queries and use selective queries and what's a covered query)
  • tutorial/evaluate-operation-performance
  • 4.2

skipping the specific explain command/methods pages since we don't go into output on those pages. But could think about a small changelog on those pages regarding changes.

Impact to other docs outside of this product

MVP (work and date?)

Resources (e.g. Scope Docs, Invision)



 Comments   
Comment by Githook User [ 31/Jan/19 ]

Author:

{'email': 'kay.kim@mongodb.com', 'name': 'Kay Kim'}

Message: DOCS-11962,DOCS-12387,DOCS-11959,DOCS-11965: queryHash and planCacheKey
Branch: master
https://github.com/mongodb/docs/commit/0e367a666aac090a7ed617e20309a1b1760911b7

Generated at Thu Feb 08 08:04:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.