[SERVER-55896] Mongo full text search on a small collection (approx. 1.5 million entries) Created: 08/Apr/21  Updated: 08/Apr/21  Resolved: 08/Apr/21

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

Type: Question Priority: Major - P3
Reporter: Ian Hannah Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

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.

 

 



 Comments   
Comment by Eric Sedor [ 08/Apr/21 ]

Hi ihannah@meniscus.co.uk,

We'd expect exact phrase searches to be slower in general because text indexes do not store information about the proximity of words in a document.

For assistance using MongoDB in the most performant way for your use-case and for understanding the performance you can get out of specific hardware and features, we'd like to encourage you to start by asking our community for help by posting on the MongoDB Developer Community Forums.

If the discussion there leads you to suspect a bug in the MongoDB server, then we'd want to discuss here in the SERVER project. This SERVER project is for bugs and feature suggestions for supported versions of the MongoDB server.

I did also want to mention that version 3.6 is reaching end of life this month (April 2021). We'd recommend upgrading if at all possible.

Sincerely,
Eric

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