[SERVER-82471] Make sure explain.find issued on mongos sends a modified query to the shards Created: 26/Oct/23  Updated: 17/Nov/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Denis Grebennicov Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: quick-win, tech-debt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-29449 Explain of find command does not tran... Backlog
Related
related to SERVER-32563 explain output for sharded count comm... Backlog
is related to SERVER-82218 Unify explain and execution path in s... Closed
Assigned Teams:
Query Execution
Operating System: ALL
Participants:

 Description   

While mongos sends modified find query to shards (as part of ClusterFind::runQuery()), it does so only when the command has to be executed and not explained.

This causes confusion for users as well as developers and make you not trust in explain output, as it is not the same plan.

As well as this makes testing harder, as explained plan is not the same as the plan found in the $planCacheStats

It's worth mentioning that since queries in run and explain are different, so are their queryHashes, therefore once can not run explain, retrieve the queryHash and look for the queries in $planCacheStats or slow query logs, as they are different.

 

This issue goes back in time, to at least 3.4.4, so it's a very old bug.


Generated at Thu Feb 08 06:49:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.