mariadb/mysql-test/main/mdev_36132.test
Yuchen Pei 2136d209af
MDEV-36132 [wip] Subst vcol fields and update its index covering
A combination of ORDER BY vcol expr to vcol fields substitution, and
updating vcol field index covering.

The improvement of EXPLAIN output in the test is identical to that of
simply updating vcol field index covering without any substitution.
2025-05-08 15:51:35 +10:00

68 lines
1.7 KiB
Text

--source include/have_sequence.inc
create table t (c int, key (c));
insert into t select seq from seq_1_to_10000;
alter table t
add column vc int as (c + 1),
add index(vc);
explain select c from t order by c;
explain select vc from t order by vc;
explain select vc from t order by vc limit 10;
explain select c + 1 from t order by c + 1;
explain select c + 1 from t order by vc;
explain select vc from t order by c + 1;
explain select vc from t order by c;
explain select c from t order by vc;
explain select c from t order by c + 1;
explain select vc from t order by c + 1 limit 2;
explain select c + 1 from t order by c + 1 limit 2;
explain select c + 1 from t order by vc limit 2;
drop table t;
## ----
# create table t (c int, key(c));
# insert into t select seq from seq_1_to_10000;
# alter table t
# add column vc int as (c + 1),
# add index(vc);
# /* 1 */ explain select vc from t order by c + 1;
# /* 2 */ explain select vc from t order by c + 1;
# drop table t;
## ----
# create table t (c int, key (c));
# insert into t values (1), (2), (3);
# alter table t
# add column vc int as (c + 1),
# add index(vc);
# explain select c from t order by c;
# explain select vc from t order by vc;
# explain select c + 1 from t order by c + 1;
# explain select c + 1 from t order by vc;
# explain select vc from t order by c + 1;
# explain select vc from t order by c;
# explain select c from t order by vc;
# drop table t;
## ----
# --source include/have_sequence.inc
# create table t (c int);
# insert into t select seq from seq_1_to_10000;
# alter table t
# add column vc int as (c + 1),
# add index(vc);
# explain select 1 from t order by vc limit 10;
# drop table t;