Skip to content

Why Mango query with index is much slower? #3264

Answered by kocolosk
Majlanky asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, this is a case where the warning is not worth heeding.

An important detail: the index you create in Mango is not a covering index. It will only return the _ids of the documents matching your selector; the server still needs to go and retrieve those document bodies for you. In contrast, when Mango operates without a secondary index it does have direct access to the bodies of the matching documents.

In this case, your selector is matching 88% of the documents that it examined in the database without any index. That's a very good hit rate. You should consider if this was just due to a particular choice of document ID that might change in the future, or if this query is actually never goi…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Majlanky
Comment options

@kocolosk
Comment options

Answer selected by Majlanky
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants