[SERVER-36527] Include queryHash in explain output Created: 08/Aug/18  Updated: 29/Oct/23  Resolved: 09/Aug/18

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 4.1.2

Type: Improvement Priority: Major - P3
Reporter: David Storch Assignee: David Storch
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
is documented by DOCS-11959 Docs for SERVER-36527: Include queryH... Closed
Backwards Compatibility: Fully Compatible
Sprint: Query 2018-08-13, Query 2018-08-27
Participants:
Case:

 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
}



 Comments   
Comment by Githook User [ 09/Aug/18 ]

Author:

{'username': 'dstorch', 'name': 'David Storch', 'email': 'david.storch@10gen.com'}

Message: SERVER-36527 Add 'queryHash' to 'queryPlanner' explain output.
Branch: master
https://github.com/mongodb/mongo/commit/25033952fa8cd51f18acada50f1894c232b610ff

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