[SERVER-83414] [CQF] Design how histogram CE interacts with parameterized queries Created: 17/Nov/23  Updated: 28/Nov/23

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

Type: New Feature Priority: Major - P3
Reporter: Ben Shteinfeld Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Optimization
Participants:

 Description   

When parameterization is enabled in CQF, the intervals generated in SargableNodes are no-longer guaranteed to have constant bounds, they will be expressions. While we do maintain a mapping of parameter ID to constant in the given query, simply replacing references to parameters with constants is not sufficient, we'd need to invoke constant folding to get back a set of intervals with constant bounds. Doing so would require copying an ABT with potentially large constants in it, which may have performance implications; since we don't have to mutate the ABT that CE is given, since that get inserted into the memo.

This ticket is a placeholder for work to design and implement a solution to this problem. One idea: disable interval simplification in SargableNode and estimate the CE of all predicates independently; this would allow direct replacement of parameter markers for their constant values.


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