-
Type: Question
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Index Maintenance
-
None
We have a collection with approx. 1.5 million rows.
We have a full text search index created in code as follows:
m_itemsCollection.CreateIndex(IndexKeys.TextAll(), IndexOptions.SetTextDefaultLanguage("none"));
Running a query on the database as follows:
db.items.find({ "$text" :
{ "$search" : "\"average\"" }}).count()
Takes around 5 seconds to return a value of 250000 which is not terrible but not fast either.
Running the following query however:
db.items.find({ "$text" :
{ "$search" : "\"average rainfall\"" }}).count()
Takes around a minute to return a value of 200000.
The queries are using an IXSCAN as expected but why are they so slow? The documents are not particular complicated.
We are using Mongo 3.6.8. We could upgrade if there are performance improvements in later versions but we need to understand why text search is so slow as it is unusable at the moment.