forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
opt: build inverted index scan constraints from JSON fetch val operator
GenerateInvertedIndexScans now generates InvertedConstraints from equality expressions with a JSON FetchVal operator on the left side and a constant on the right side, like `j->'a' = '1'`. Previously Constraints were built for these expressions with the `idxconstraint` package. By building InvertedConstraints from FetchVal operators, the optimizer now has the ability to generate inverted index scans with conjunctive and disjunctive filters containing FetchVal operators. For example, the optimizer will plan an inverted index scan with the query below. CREATE TABLE t (k INT PRIMARY KEY, j JSON, INVERTED INDEX (j)) SELECT k FROM t WHERE j->'a' = '1' AND j->'b' = 2 This change also brings us a step closer to cleaning up the `idxconstraint` by removing code related to inverted indexes. Informs cockroachdb#47340 Release note (performance improvement): The query optimizer now plans scans over inverted indexes on JSON columns for query filters that constrain the JSON column with equality and fetch value operators (`->`) inside conjunctions and disjunctions, like `j->'a' = '1' AND j->'b' = '2'`.
- Loading branch information
Showing
6 changed files
with
317 additions
and
13 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
Oops, something went wrong.