Details
-
New Feature
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
Description
This MDEV covers basic optimizer support for virtual columns added in 11.8.
If a user declares a virtual column and an index on it
ALTER TABLE t1 |
ADD COLUMN vcol INT AS (col1+1), |
ADD INDEX idx1(vcol); |
and then a query uses the exact same expression:
SELECT * FROM t1 WHERE col1+1 <= 100 |
Then the optimizer will rewrite the above into
... WHERE vcol <= 100 |
which enables the rest of the optimizer to construct query plans that use index idx1.
The rewrite is performed in WHERE/ON clauses (and only there).
The rewrite targets indexed virtual columns.
The rewrite targets a subset of conditions usable by the range optimizer:
vcol_expr $CMP const1 where $CMP is = or [less|greater][or equal].
|
vcol_expr BETWEEN const1 AND const2
|
vcol_expr IN (const-list)
|
vcol_expr IS [NOT] NULL
|
Attachments
Issue Links
- blocks
-
MXS-5346 Properly support [create|drop|list]Indexes
-
- Closed
-
- causes
-
MDEV-35833 Assertion `marked_for_read()' failed after DELETE/UPDATE from table with virtual columns
-
- Closed
-
-
MDEV-35913 Assertion `m_comparator.cmp_type() != ROW_RESULT' failed in bool Item_func_in::compatible_types_scalar_bisection_possible()
-
- Open
-
- is part of
-
MDEV-6017 Add support for Indexes on Expressions
-
- Stalled
-
- relates to
-
MDEV-35615 Query optimizer support for functional indexes: next steps
-
- Open
-
-
MDEV-35496 JSON_UNQUOTE produces utf8mb3 output while JSON can be utf8mb4
-
- Confirmed
-
-
MDEV-36299 Issues with collations when using indexed JSON attribute search
-
- Open
-