-
Type: Question
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 4.2.0
-
Component/s: None
-
None
Hi,
I am trying to improve count using covered queries but its taking ~5sec to return the response.
Is this behavior expected or there is something I can do to improve this.
Please find details below-
There is collection with 6 million records
consider each document to be something like this
{ "_id": "523453252", "type": "test" }i have a single field index on "type"
when I execute following command
db.test.explain("executionStats").find({type:{$in:["test","test1","test2"]}},{type:1,_id:0}).count()
the number of keys examined are ~5.9 million
number of docs examined are 0
even though there are no docs examined i.e nothing is loaded from disk
and the query is using only index the count is taking ~5sec
Please let me know if there is anything that can be done to improve count response time.
- duplicates
-
SERVER-17266 count command performance optimization should support more complex queries
- Backlog