-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.6.8, 3.0.0
-
Component/s: Querying, Text Search
-
None
-
ALL
-
Currently, text indexes seem to interact very poorly with other indexes. In many cases with low result counts, adding a normally-indexed field will actually slow the search down significantly (which is counterintuitive).
Example in our app:
db.items.find({ indexedField: ObjectId('523ec53087d4200202000006') })
completes in ~1 ms with ~400 results, using the indexedField index
db.items.find({ compoundTextIndex: 'grade' })
completes in ~180 ms with ~70,000 results, using the compoundTextIndex index
db.items.find({ indexedField: ObjectId('523ec53087d4200202000006'), compoundTextIndex: 'grade' })
completes in ~250 ms with ~20 results, using the compoundTextIndex index
This third example clearly doesn't make sense. It would be faster in this case to perform the indexed query and then filter down the results by text at the application level! It should be using the indexedField index instead of compoundTextIndex.
This actually crashes our app sometimes, taking over 30 seconds in real-life queries. So it's pretty major for us.
- is related to
-
SERVER-17648 Implement matcher for text predicates
- Backlog