forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
opt: inverted-index accelerate queries with filters in the form json-…
…>'field' IN (...) Previously, the optimizer did not plan inverted index scans for queries consisting of the IN operator. To address this, we now build JSON arrays from fetch value expressions consisting of both integers and strings. Each entity present inside of the tuple following the IN operator has it's own seperate JSON array being created. From these JSON arrays, inverted spans are built. Each inverted span generated is OR'ed together to replicate the functionality of the IN operator. In other words, a filter of the form: j->0 IN ('1', '2') is thought of as (j->0 = '1') OR (j->0 = '2') and the generated inverted span replicates this behaviour. Epic: CRDB-3301 Fixes: cockroachdb#87856 Release note (performance improvement): The optimizer now plans inverted index scans for queries that filter by JSON fetch value operators (->), consisting of both string and integer index values, alongside the IN operator, e.g, json_col->0 IN ('1', '2') and json_col->'a' IN ('1', '2')
- Loading branch information
Showing
4 changed files
with
780 additions
and
1 deletion.
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
Oops, something went wrong.