[SERVER-86289] Omit unnecessary cfilter PlanStage in parameterized SBE index plans Created: 06/Feb/24  Updated: 07/Feb/24

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

Type: Task 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   

In the MixedWorkloads genny workload (high-value workload), there are queries of the form

 

findOne({id: <int>})

Note that the field id is not _id, but does have a secondary index.

 

This leads to a plan like

slots: '$$RESULT=s11 env: { s5 = Nothing, s3 = 1706728396314 (NOW), s10 = {"id" : 1}, s1 = TimeZoneDatabase(Asia/Dhaka...Africa/Addis_Ababa) (timeZoneDB), s2 = Nothing (SEARCH_META), s6 = Nothing
[3] limit 1
[2] nlj inner [] [s4, s7, s8, s9, s10]
   left
       [1] cfilter {(exists(s5) && exists(s6))}
       [1] ixseek s5 s6 s9 s4 s7 s8 [] @"f86e4a9b-d340-47b9-9936-c2c880428773" @"id_1" true
   right
        [2] limit 1
        [2] seek s4 s11 s12 s7 s8 s9 s10 [] @"f86e4a9b-d340-47b9-9936-c2c880428773" true false 

The constant filter stage above the ixseek does not appear to be necessary since we know that the bounds will be constants and parameterized in the query.

This be obsoleted by SERVER-86237, but it might help with queries not covered by that ticket.


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