You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by gi...@git.apache.org on 2017/09/14 12:37:56 UTC

[GitHub] willholley opened a new pull request #816: Fix mango json index selection

willholley opened a new pull request #816: Fix mango json index selection
URL: https://github.com/apache/couchdb/pull/816
 
 
   ## Overview
   
   JSON index selection in Mango previously deemed an index to be usable if a range scan on the first component of its compound key could be generated from the query selector.
   
   For instance, if I had an index:
   
   [A, B]
   
   is_usable would return true for the selector:
   
   {"A": "foo"}
   
   This is incorrect because JSON indexes only index documents that contain all the fields in the index; null values are ok, but the field must be present. That means that for the above selector, the index would implicitly include only documents where B exists, missing documents where {"A":5} matched but field B was not present.
   
   This commit changes is_usable so that it only returns true if all the keys in the index are required to exist by the selector. This means that in the worst case e.g. none of the predicates can be used to generate a range query, we should end up performing a full index scan, but this is still more efficient
   than a full database scan.
   
   We leave the generation of the optimal range for a given index as a separate exercise - currently this happens after index selection.
   
   Potentially we'd want to score indexes during index selection based on their ability to restrict the result set, etc.
   
   ## Testing recommendations
   
   Run the mango test suite. Manually run some mango queries with/without JSON indexes and check that the results are as expected.
   
   ## Checklist
   
   - [ ] Code is written and works correctly;
   - [ ] Changes are covered by tests;
   - [ ] Documentation reflects the changes;
   
 
----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services