[SERVER-6389] Consider index for range+equality style queries Created: 11/Jul/12  Updated: 15/Aug/12  Resolved: 11/Jul/12

Status: Closed
Project: Core Server
Component/s: Index Maintenance, Performance
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Scott Hernandez (Inactive) Assignee: Unassigned
Resolution: Duplicate Votes: 1
Labels: indexes, query
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

Currently you can hint to use an index for range+equlity matches but the index will not be considered otherwise. I would like to see it be considered like any other potential index.

Example of desired behavior:

db.coll.insert({a:twoDaysAgoDate, b:2})
... // millions of docs where a is less than 2 days ago
db.coll.ensureIndex({a:1,b:1})
db.coll.find({a:{$gt:oneDayAgoDate}, b:2}) //uses index, doesn't now.



 Comments   
Comment by Scott Hernandez (Inactive) [ 11/Jul/12 ]

Already working as long as there isn't a better index of the form

{b:1, a:1}
Generated at Thu Feb 08 03:11:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.