[SERVER-36528] Implement $planCacheStats aggregation metadata source Created: 08/Aug/18  Updated: 29/Oct/23  Resolved: 21/Aug/18

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

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:
Depends
Documented
is documented by DOCS-11982 Docs for SERVER-36528: Implement $pla... Closed
Related
related to SERVER-36800 Deprecate 'planCacheListPlans' and 'p... Closed
Backwards Compatibility: Fully Compatible
Sprint: Query 2018-08-27
Participants:

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

Author:

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

Message: SERVER-36528 Implement $planCacheStats agg source.

The $planCacheStats agg metadata source should typically be used
instead of the older 'planCacheListPlans' and
'planCacheListQueryShapes' commands (although these plan cache
commands are still fully supported).

Lookup by 'queryHash' can be achieved via a $planCacheStats-$match
pipeline.
Branch: master
https://github.com/mongodb/mongo/commit/21762f8b9b8c64fd32bed173eb74e2172088e21b

Comment by David Storch [ 13/Aug/18 ]

Per discussion with ian.boros, we plan to achieve this by:

  1. Adding a {$planCacheStats: {}} aggregation metadata source, which opens a cursor that returns one document per plan cache entry.
  2. Implementing a $match pushdown optimization, so that only matching plan cache entries need to be copied into DocumentSourcePlanCache. This should control the memory consumption for a $planCache cursor.

Users who wish to find plan cache entries with a particular query hash can run something like

db.myColl.aggregate([{$planCache: {}}, {$match: {queryHash: "1234ABCD"}}])

The initial draft of this work will be gated by the testCommandsEnabled flag.

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