order by vcol test fixups
This commit is contained in:
parent
ae5b1acc55
commit
62dc96cd7e
@ -89,3 +89,46 @@ vc
|
||||
2
|
||||
2
|
||||
drop table t;
|
||||
create table t (c int);
|
||||
insert into t select seq from seq_1_to_10000;
|
||||
alter table t
|
||||
add column vc1 int as (c + 1);
|
||||
alter table t
|
||||
add column vc2 int as (1 - c),
|
||||
add index(vc1, vc2);
|
||||
explain select vc1, vc2 from t order by c + 1, 1 - c;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t ALL NULL NULL NULL NULL 10000 Using filesort
|
||||
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 vc1 int as (c + 1),
|
||||
add index(vc1);
|
||||
alter table t
|
||||
add column vc2 int as (1 - c),
|
||||
add index(vc2);
|
||||
set @old_optimizer_trace=@@optimizer_trace;
|
||||
set optimizer_trace=1;
|
||||
explain select * from t order by c + 1, 1 - c;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t index NULL c 5 NULL 10000 Using index; Using filesort
|
||||
select
|
||||
json_detailed(json_extract(trace, '$**.virtual_column_substitution'))
|
||||
from
|
||||
information_schema.optimizer_trace;
|
||||
json_detailed(json_extract(trace, '$**.virtual_column_substitution'))
|
||||
[
|
||||
{
|
||||
"location": "ORDER BY",
|
||||
"from": "t.c + 1",
|
||||
"to": "t.vc1"
|
||||
},
|
||||
{
|
||||
"location": "ORDER BY",
|
||||
"from": "1 - t.c",
|
||||
"to": "t.vc2"
|
||||
}
|
||||
]
|
||||
set optimizer_trace=@old_optimizer_trace;
|
||||
drop table t;
|
||||
|
Loading…
x
Reference in New Issue
Block a user