J
J
joger2011-11-30 11:58:39
PHP
joger, 2011-11-30 11:58:39

MongoDB performance

there is a MongoDB collection of something like this: Indexes on A2_LastnameC and A2_FirstnameC in total 3 million documents Query like $collection->find(array("A2_FirstnameC" => new MongoRegex("/jose/i")))->sort(array( "A2_LastnameC" => -1))->limit(10) lasts 3.5 seconds on i7 8GB RAM. Is it fast, slow? Can you do less?

{
"A2_AboutMe": "",
"A2_Attributes": "|av|nv|",
"A2_Birthday": "",
"A2_DateCreated": "2010-11-25 22: 59: 00",
"A2_DateLastCrawl": "2011-11-18 12: 09: 36",
"A2_FK_A1_IDPerson": "0",
"A2_Firstname": "José Luis",
"A2_FirstnameC": "Jose Luis",
"A2_Gender": "m",
"A2_IDProfile": "1",
"A2_Keywords": "Passwort: 16|WaltherAcosta: 14|Fenster: 14|Internet: 12|Entwicklung: 12|Luis: 12|Acosta: 12|Deutschland: 11|Mechatronik: 9|Spain: 9|Werbung: 8|Sicherheit: 8|Produ [...]",
"A2_Lastname": "Walther - Acosta",
"A2_LastnameC": "_Walther Acosta",
"A2_Locale": "",
"A2_Middlename": "",
"A2_Name": "José Luis Walther - Acosta",
"A2_NameC": "Jose Luis Walther Acosta"
}






Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexey, 2011-11-30
@CheatEx

A query with a regular expression uses indices only if the string prefix is ​​uniquely specified (read the expression begins with "/^"). Your request interrupted the entire dataset.
For the future: please post examples of requests to monge from the JS console. This is a standard tool, everyone understands it, the examples in it can be reproduced by everyone.

P
Puma Thailand, 2011-11-30
@opium

For a long time. Look at least top on the car.

N
N3K, 2011-11-30
@N3K

Check out : www.mongodb.org/display/DOCS/Explain .
For speed up, try using sphinx. It will greatly speed up the search.

J
joger, 2011-11-30
@joger

which in principle is required, because /^jose/ is only part of /jose/
and explain says that the index is used in both cases
, by the way, the time is again > 3 seconds for both options

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question