kgeorgiou opened a new issue #1566: Mango operator `$in` does not utilize index
URL: https://github.com/apache/couchdb/issues/1566
 
 
   <!--- Provide a general summary of the issue in the Title above -->
   For example, the following query performs a full scan:
   ```
   {
      "selector": {
         "a": {
            "$in": [
               "foo"
            ]
         }
      },
      "use_index": [
         "test",
         "index-by-a"
      ]
   }
   ```
   
   ## Expected Behavior
   <!--- If you're describing a bug, tell us what should happen -->
   <!--- If you're suggesting a change/improvement, tell us how it should work 
-->
   Would expect the same performance as the following query:
   ```
   "selector": {
      "a": "foo"
   }
   ``` 
   (That is for the special case where only a single element is in the `$in` 
array. However, for `M` elements in the array, would still expect something 
along the lines of `M` lookups instead of a full scan.)
   ## Current Behavior
   <!--- If describing a bug, tell us what happens instead of the expected 
behavior -->
   <!--- If suggesting a change/improvement, explain the difference from 
current behavior -->
   A full scan is performed, essentially ignoring the index on field `a` and 
yielding linear time runtime complexity.
   ## Possible Solution
   <!--- Not obligatory, but suggest a fix/reason for the bug, -->
   <!--- or ideas how to implement the addition or change -->
   Iterate over the `$in` array and perform a lookup (that utilizes the index) 
for each element. 
   
   ## Your Environment
   <!--- Include as many relevant details about the environment you experienced 
the bug in -->
   * Version used: 2.2.0
   

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