-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
998c9ed
commit 60ee528
Showing
5 changed files
with
191 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -493,7 +493,6 @@ def add_text_indexes(db, kwargs): | |
}, | ||
"company": "Pharmex", | ||
"email": "[email protected]", | ||
"manager": True, | ||
"favorites": [ | ||
"Erlang", | ||
"Python", | ||
|