-
Type: Question
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.6.13
-
Component/s: Index Maintenance, Querying, WiredTiger
-
None
There seems to be some difficulty using index intersection in queries.
For example in our collection we have the following query (you will understand the fields from the filter object):
db.getCollection('Measurement').find({ assetId: ObjectId('5c180b16fd86b100119fc400'), timestamp: { $gte: ISODate('2018-08-08T10:13:00'), $lte: ISODate('2019-08-08T10:13:00')}, source: { $in: [0,2,3]}, sourceId: { $in: ['5C180B16FD86B100119FC400_VIRTUAL_1', '5C180B16FD86B100119FC400_VIRTUAL_2', 'DEMO_NODE_ID-2'] } })
In the collection amongst others the following indexes:
{ assetId: 1 }
{ timestamp: 1, sourceId: 1, source: 1}
However, running the query with explain, shows that the query planner selects to run the query only using assetId index and not an intersection of the other two which would completely cover the query.
Why is this happenning?
- duplicates
-
SERVER-12923 Plan ranking is bad for plans with blocking stages
- Backlog