[SERVER-10674] Ability to narrowly scope potential indexes via inclusion and/or exclusion lists Created: 04/Sep/13  Updated: 21/Aug/14  Resolved: 20/Aug/14

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

Type: New Feature Priority: Major - P3
Reporter: Christopher Price Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-9306 Ability to temporarily forbid query o... Closed
Participants:

 Description   

The ability to target multiple potential indexes for consideration or target a list of indexes to exclude from consideration in fulfilling a query request would be useful for sort operations using compound indexes. For performance reasons this is important in cases where some queries search for a single value and some queries search for multiple values using $in.

Use case:
An application creates three indexes on a collection as follows:

{"a":1, "b":-1}
("b"-1", "a":1}
{"a":1, "c":1"}

The application requires both of the first two indexes because it queries for either:

{"a":{$in:[x]}, "c":{$in:[e,f,g]}}

or

{"a":{$in:[x,y,z]}, "c":{$in:[e,f,g]}}

But in both cases the application sorts on

{"b":-1}

Unfortunately Mongo frequently picks the index on

{"a":1, "c":1}

and then executes a comparatively expensive scanAndOrder.

A new feature that allows for the specification of a list of "anti-hints" and/or allows for the specification of a list of non-priority ordered index "possibilities" would remove the need for client logic to interpret the best index to use in these types of cases. Specifically, having to inspect the query and sort parameters in order to choose between the first two indexes listed above.

Assumption: Each unique inclusion/exclusion permutation would be considered a distinct query plan from a query that does not specify these values.



 Comments   
Comment by Thomas Rueckstiess [ 20/Aug/14 ]

Some of these requested features are already covered by Index Filters. Others are duplicated by SERVER-9306.

Generated at Thu Feb 08 03:23:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.