[SERVER-83367] [CQF] Include source of cardinality estimates in logical properties Created: 16/Nov/23  Updated: 04/Dec/23  Resolved: 04/Dec/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.3.0-rc0

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

Backwards Compatibility: Fully Compatible
Participants:

 Description   

When we estimate individual predicates, we put the results in a logical property:

        "|   |   Logical:\n"
        "|   |       cardinalityEstimate: \n"
        "|   |           ce: 189.571\n"
        "|   |           requirementCEs: \n"
        "|   |               refProjection: root, path: 'PathGet [a] PathIdentity []', ce: 330\n"
        "|   |               refProjection: root, path: 'PathGet [b] PathGet [c] PathIdentity "
        "[]', ce: 330\n"

https://github.com/10gen/mongo/blob/7ab5c60c1c99ac7ecfbf9e79d5de08dd29fcb37a/src/mongo/db/query/optimizer/physical_rewriter_optimizer_test.cpp#L3299-L3301

Let's also include a string describing which CE method was used.

  • Change the deriveCE() method to return pair<CEType, std::string>.
  • Each CE implementation should return a short string like "heuristic" or "sampling".
  • When one CE implementation delegates to another (like when sampling falls back to heuristic) we should report the ultimate source of the CEType (heuristic) and not the wrapper.
  • Update the PartialSchemaKeyCE structure (in CardinalityEstimate) to hold the string for each estimate.
  • Update explain.


 Comments   
Comment by Githook User [ 01/Dec/23 ]

Author:

{'name': 'Daniel Segel', 'email': 'daniel.segel@mongodb.com', 'username': 'dhsegel'}

Message: SERVER-83367 Create and use CERecord in Logical Properties
Branch: master
https://github.com/mongodb/mongo/commit/19bf481eed2377426769cc25fa447134f82e46e3

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