-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 1.8.2
-
Component/s: Performance, Querying
-
Environment:Mac OS X 10.6.8 2.16 GHz
Intel Core 2 Duo
2 GB 667 MHz DDR2 SDRAM
-
ALL
I'm using a dummy collection of 18M rows in the following format:
{ _id: __unique_of_course__, name: __also_unique__, dummyID: __not_unique__ }There's an additional index on dummyID:
db.dummy.ensureIndex(
);
Now, when I query it ...
db.dummy.count(
);
This will take several seconds ....
Now, when I query the following ...
db.dummy.find(
).sort(
{dummyID: -1}).limit(10);
This takes just one ms or so ...
Is this some bug, or did I just forgot something?
It'ld make sense if sorting a 18M result-set took more time than counting it ...
(note: it may be faster when testing it on a real server, I'm testing it on my MacBook right now. Look at the relative difference between the benchmarks).