wohali commented on issue #1566: Mango operator $in does not utilize index
URL: https://github.com/apache/couchdb/issues/1566#issuecomment-414012485
 
 
   @kgeorgiou First, validate that your index is being used with the 
`/_db/explain` endpoint.
   
   Second, my understanding is that `$in` and `$regex` always require the 
equivalent of a "full table scan" due to the fact that they are inexact 
operators. This is an inherent limitation of how Mango is implemented under the 
covers (same MapReduce as JS views), and at present further no acceleration is 
possible.
   
   You can work around this inherent limitation in certain cases; for instance, 
if you want to perform an `$in` search on `a` but only on documents with `type: 
foo`, then you can create a [partial 
index](http://docs.couchdb.org/en/stable/api/database/find.html#find-partial-indexes)
 on documents of `type: foo` and the search, which will be in linear time 
against just that subset of documents.
   
   Sorry for the disappointment, and hope the above workaround can help you 
achieve better performance.

----------------------------------------------------------------
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

Reply via email to