garrensmith commented on issue #1549: Slow `_find` query when no documents match selector URL: https://github.com/apache/couchdb/issues/1549#issuecomment-411657758 @wohali is right that the query that takes long is doing a full index scan on `_all_docs` as you can see from the stats: ``` "execution_stats": { "total_keys_examined": 0, "total_docs_examined": 24856, "total_quorum_docs_examined": 0, "results_returned": 0, "execution_time_ms": 34390.737 } ``` The one that is faster is because it uses the `"publishTime"` index. Mango needs a way to know to select that index on your queries. The best way to do that is to add a publishTime into your selector even if its something like `publishTime: {$gt: null}`. That way it should always select that index. You can also add in the `use_index` to specify that index. But running _explain on your queries will give you some information around what is happening internally and which index is being selected. Since you using `league` in your query it might be worth adding that into the index as well even if you only use it with the $in selector. That way only the docs with a league field and a publishTime field will be in your index.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
