Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
59499: opt: scan partial indexes with virtual columns in predicate r=mgartner a=mgartner This commit makes it possible for the optimizer to generate scans on partial indexes with predicates that have references to virtual columns. When partial index predicate expressions are added to table metadata, virtual column expressions are inlined. This allows implication to be proven by a query filter with virtual columns that have also been inlined by the PushSelectIntoInlinableProject rule. Unfortunately, this only supports query filters that have expressions that exactly match the partial index predicate. Partial index implication is not guaranteed to be proven for queries that imply a partial index predicate in theory, but do not have exactly matching expressions. For example: CREATE TABLE t ( k INT PRIMARY KEY, a INT, b INT, c INT AS (b + 10) VIRTUAL, INDEX (a) WHERE c IN (10, 20, 30) ) SELECT k FROM t WHERE c = 20 The virtual column in the query filter `c = 20` is inlined to `(b + 10) = 20` and the expression is normalized to `b = 10`. The virtual column in the partial index `c IN (10, 20, 30)` is normalized to `(b + 10) IN (10, 20, 30)`. Implication cannot easily be proven for the filter `b = 10` and the predicate `(b + 10) IN (10, 20, 30)`. Release note: None 59594: opt: remove unused inverted index logic in idxconstraint r=mgartner a=mgartner Constraining inverted indexes is now done with InvertedConstraints. Logic in idxconstraint for generating Constraints for inverted indexes is no longer used and has been removed. Release note: None Co-authored-by: Marcus Gartner <[email protected]>
- Loading branch information