[CQF] Satisfy 'Traverse ComposeM' predicates with IndexScan + Filter (SERVER-71871)

[SERVER-77733] [CQF] Simplify PathArr paths based on Multikeyness info Created: 02/Jun/23  Updated: 29/Oct/23  Resolved: 03/Aug/23

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

Type: Sub-task Priority: Major - P3
Reporter: Svilen Mihaylov (Inactive) Assignee: Matt Olma
Resolution: Fixed Votes: 0
Labels: bonsai-onboarding
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: QO 2023-05-15, QO 2023-05-29, QO 2023-06-12, QO 2023-06-26, QO 2023-07-10, QO 2023-07-24, QO 2023-08-07, QO 2023-08-21, QO 2023-09-04, QO 2023-09-18, QO 2023-10-02, QO 2023-10-16, QO 2023-10-30
Participants:

 Description   

Consider a filter expression such as Get "a" Arr. If "a" is never multikey this expression can never be true.

The task is to extend the logical rewrite which transforms a filter expression to do the above.

Specifically:

Given a collection coll with {id, x}{} where x is a scalar field (i.e., no arrays) and an index on field {}x{_}.

query:

db.coll.find({x : { $elemMatch: {$eq: 5 } } })

successfully recognizes that x is a scalar field and simplifies the expression to return nothing without scanning the collection.

On the other hand,

query: 

db.coll.find({x : { $elemMatch:{y: 5}} })

which assumes a subfield y in x despite x being scalar and not having a y subfield, the query actually scans the whole collection. We observe the same behavior even when we have an index on x.y.

The ticket aims to alleviate this behavior and allow recognizing this opportunity for optimization.



 Comments   
Comment by Githook User [ 03/Aug/23 ]

Author:

{'name': 'Matt Olma', 'email': 'matt.olma@mongodb.com', 'username': 'mattsimply'}

Message: SERVER-77733 Simplify PathArr paths based on Multikeyness info
Branch: minh.luu-no_compile_sys-perf
https://github.com/mongodb/mongo/commit/a92008357157641aadbeb768720e0d148feca865

Comment by Githook User [ 02/Aug/23 ]

Author:

{'name': 'Matt Olma', 'email': 'matt.olma@mongodb.com', 'username': 'mattsimply'}

Message: SERVER-77733 Simplify PathArr paths based on Multikeyness info
Branch: master
https://github.com/mongodb/mongo/commit/a92008357157641aadbeb768720e0d148feca865

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