mirror of
https://github.com/MariaDB/server.git
synced 2025-11-14 17:56:17 +01:00
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.
68 lines
1.7 KiB
Text
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;
|