[SERVER-69795] Use empty array counter for CE for PathArr in SargableNode Created: 19/Sep/22  Updated: 29/Oct/23  Resolved: 12/Oct/22

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

Type: Task Priority: Major - P3
Reporter: Alya Berciu Assignee: Timour Katchaounov
Resolution: Fixed Votes: 0
Labels: M2
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: QO 2022-10-17
Participants:

 Description   

When estimating an $elemMatch predicate, the requirements map of a Sargable node may include a special 'PathArr' predicate that signals we should estimate this field using $elemMatch semantics. This predicate may be split out into its own SargableNode during the MemoExploration phase.

When this happens, we need a special case in order to get a correct estimate when we see a Sargable node with just a requirements map entry like PathGet "a" PathIdentity [array interval]. We should use a counter of empty arrays in statistics to obtain a reasonable estimate for the proportion of arrays we expect in the output of the SargableNode.



 Comments   
Comment by Githook User [ 13/Oct/22 ]

Author:

{'name': 'Timour Katchaounov', 'email': 'timour.katchaounov@mongodb.com', 'username': 'timourk'}

Message: SERVER-69795 PathArr estimation via Array type counter

Fix linter error.
Branch: master
https://github.com/mongodb/mongo/commit/6b1ee37c1f04ae349636047b3619bcb9829d7e7b

Comment by Timour Katchaounov [ 12/Oct/22 ]

svilen.mihaylov@mongodb.com could you give us some more information about PathObj? Few examples perhaps. I wasn't aware until this comment that we have to estimate it as an interval. I will file a ticket once you provide some more details (asked below).

Do you mean that PathObj can also end up alone in a SargableNode as a special interval? How do we recognize its special interval?

If so, we should be able to estimate it via the type counter for objects.

Comment by Githook User [ 12/Oct/22 ]

Author:

{'name': 'Timour Katchaounov', 'email': 'timour.katchaounov@mongodb.com', 'username': 'timourk'}

Message: SERVER-69795 PathArr estimation via Array type counter
Branch: master
https://github.com/mongodb/mongo/commit/ea85b99ada1fe21761f1e4f442f53509fda09d3a

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