[SERVER-23093] String comparison predicates using an index with a collation should generate EXACT bounds (but cannot be covered) Created: 11/Mar/16  Updated: 02/Sep/16  Resolved: 15/Aug/16

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 3.3.12

Type: Task Priority: Major - P3
Reporter: Tess Avitabile (Inactive) Assignee: David Storch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Query 2016-08-29
Participants:

 Description   

Currently the IndexBoundsBuilder enforces the property that we never generate a covered plan which will return collator-generated index keys to the user. It does this by returning a tightness of INEXACT_FETCH for any predicate which translates to string bounds over an index with a non-null collator. The consequence is that the access planner will affix such predicates as a filter to the FETCH stage. However, passing the documents through this additional filter is not necessary, since the bounds are logically EXACT.

For instance, suppose that we have an index {a: 1} with a mock collation whose comparison keys are the reverse of the indexed strings. If we insert {a: 'foo'} into the collection, this will generate index key {'': 'oof'}. The current planner implementation will generate a plan that scans the bounds ['oof', 'oof'], fetches the corresponding document, and then filters again by the predicate {a: 'foo'}. Although the FETCH is necessary to recover the original string, the filter is not needed. The bounds ['oof', 'oof'] recover exactly the set of documents that match according to the collation!



 Comments   
Comment by Githook User [ 15/Aug/16 ]

Author:

{u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}

Message: SERVER-23093 avoid extra predicate evaluation for indexed collation-aware queries
Branch: master
https://github.com/mongodb/mongo/commit/e7b0ba5c67df867bfb31bd6028b41631f04164a6

Generated at Thu Feb 08 04:02:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.