[SERVER-24975] Query: Best indexing strategy for specific find command Created: 11/Jul/16  Updated: 14/Jul/16  Resolved: 11/Jul/16

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

Type: Question Priority: Major - P3
Reporter: Francisco Javier Pardillo Martín Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

What indexing strategy could be the best for this type of searchs:

db.getCollection('collection').find(

{'name': /a/i}

)

(Find command will always try to find a specific substring from a string, without another regex options).

We know that if there is a normal index over the "name" field, this is used, by we need more performance.

Could it be to change this find command to a "text" search command over another atribute calculated based upon all the posible letters combinations?, by example, if we had in attribute:

"name" the value "antonio"

whe could generate another atribute:

"name_extended" with values "a an ant anto anton antoni antonio"

and generate a text index over it:

db.collection.createIndex(

{ "name_extended": "text"}

)

and change our original find command to:

db.getCollection('collection').find({$text: {$search: "a", $caseSensitive: false}} )

Could it be to make a good sharding policy to spread the scan phase along multiple servers?

Could it be to focus in our application to make some limitations (only search for begining words, case sensitive)?

We´ll need your feedback to go in one or another direction, or another ideas/techniques that we haven´t take into account.



 Comments   
Comment by Ramon Fernandez Marina [ 11/Jul/16 ]

Thanks for your report francisco.pardillo@sepalo.es. Please note that the SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion please post on the mongodb-user group or Stack Overflow with the mongodb tag, where your question will reach a larger audience. A question like this involving more discussion would be best posted on the mongodb-user group. See also our Technical Support page for additional support resources.

Regards,
Ramón.

Generated at Thu Feb 08 04:07:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.