mirror of
https://github.com/MariaDB/server.git
synced 2025-01-23 07:14:17 +01:00
11dbc697aa
git-svn-id: file:///svn/mysql/tests/mysql-test@38875 c7de825b-a66e-492c-adef-691d508d4ae1
138 lines
No EOL
3.4 KiB
Text
Executable file
138 lines
No EOL
3.4 KiB
Text
Executable file
# ticket 895 is a query optimization problem with the primary key
|
|
|
|
#--source include/have_tokudb.inc
|
|
SET STORAGE_ENGINE = 'tokudb';
|
|
|
|
--disable_warnings
|
|
DROP TABLE IF EXISTS foo;
|
|
--enable_warnings
|
|
|
|
create table foo (a int, b int, c int, primary key (a,b));
|
|
insert into foo values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500),(6,60,600);
|
|
insert into foo values (1,100,100),(2,200,200),(3,300,300),(4,400,400),(5,500,500),(6,600,600);
|
|
|
|
select * from foo;
|
|
|
|
#HA_READ_KEY_EXACT
|
|
# ignore rows column
|
|
--replace_column 9 NULL;
|
|
explain select * from foo where a=4;
|
|
select * from foo where a=4;
|
|
|
|
#HA_READ_AFTER_KEY
|
|
# ignore rows column
|
|
--replace_column 9 NULL;
|
|
explain select * from foo where a>4;
|
|
select * from foo where a>4;
|
|
|
|
#HA_READ_BEFORE_KEY
|
|
# ignore rows column
|
|
--replace_column 9 NULL;
|
|
explain select * from foo where a<3 order by a desc;
|
|
select * from foo where a<3 order by a desc;
|
|
|
|
#HA_READ_KEY_OR_NEXT
|
|
# ignore rows column
|
|
--replace_column 9 NULL;
|
|
explain select * from foo where a>=4;
|
|
select * from foo where a>=4;
|
|
|
|
#HA_READ_KEY_OR_PREV not used anymore
|
|
|
|
#HA_READ_PREFIX_LAST_OR_PREV
|
|
# ignore rows column
|
|
--replace_column 9 NULL;
|
|
explain select * from foo where a<=2 order by a desc;
|
|
select * from foo where a<=2 order by a desc;
|
|
|
|
#HA_READ_PREFIX_LAST
|
|
# ignore rows column
|
|
--replace_column 9 NULL;
|
|
explain select * from foo where a=4 order by b desc;
|
|
select * from foo where a=4 order by b desc;
|
|
|
|
|
|
alter table foo drop primary key;
|
|
alter table foo add clustering index clst_a(a,b);
|
|
|
|
#HA_READ_KEY_EXACT
|
|
# ignore rows column
|
|
--replace_column 9 NULL;
|
|
explain select * from foo where a=4;
|
|
select * from foo where a=4;
|
|
|
|
#HA_READ_AFTER_KEY
|
|
# ignore rows column
|
|
--replace_column 9 NULL;
|
|
explain select * from foo where a>4;
|
|
select * from foo where a>4;
|
|
|
|
#HA_READ_BEFORE_KEY
|
|
# ignore rows column
|
|
--replace_column 9 NULL;
|
|
explain select * from foo where a<3 order by a desc;
|
|
select * from foo where a<3 order by a desc;
|
|
|
|
#HA_READ_KEY_OR_NEXT
|
|
# ignore rows column
|
|
--replace_column 9 NULL;
|
|
explain select * from foo where a>=4;
|
|
select * from foo where a>=4;
|
|
|
|
#HA_READ_KEY_OR_PREV not used anymore
|
|
|
|
#HA_READ_PREFIX_LAST_OR_PREV
|
|
# ignore rows column
|
|
--replace_column 9 NULL;
|
|
explain select * from foo where a<=2 order by a desc;
|
|
select * from foo where a<=2 order by a desc;
|
|
|
|
#HA_READ_PREFIX_LAST
|
|
# ignore rows column
|
|
--replace_column 9 NULL;
|
|
explain select * from foo where a=4 order by b desc;
|
|
select * from foo where a=4 order by b desc;
|
|
|
|
alter table foo drop index clst_a;
|
|
alter table foo add index (a,b);
|
|
|
|
#HA_READ_KEY_EXACT
|
|
# ignore rows column
|
|
--replace_column 9 NULL;
|
|
explain select * from foo where a=4;
|
|
select * from foo where a=4;
|
|
|
|
#HA_READ_AFTER_KEY
|
|
# ignore rows column
|
|
--replace_column 9 NULL;
|
|
explain select * from foo where a>4;
|
|
select * from foo where a>4;
|
|
|
|
#HA_READ_BEFORE_KEY
|
|
# ignore rows column
|
|
--replace_column 9 NULL;
|
|
explain select * from foo where a<3 order by a desc;
|
|
select * from foo where a<3 order by a desc;
|
|
|
|
#HA_READ_KEY_OR_NEXT
|
|
# ignore rows column
|
|
--replace_column 9 NULL;
|
|
explain select * from foo where a>=4;
|
|
select * from foo where a>=4;
|
|
|
|
#HA_READ_KEY_OR_PREV not used anymore
|
|
|
|
#HA_READ_PREFIX_LAST_OR_PREV
|
|
# ignore rows column
|
|
--replace_column 9 NULL;
|
|
explain select * from foo where a<=2 order by a desc;
|
|
select * from foo where a<=2 order by a desc;
|
|
|
|
#HA_READ_PREFIX_LAST
|
|
# ignore rows column
|
|
--replace_column 9 NULL;
|
|
explain select * from foo where a=4 order by b desc;
|
|
select * from foo where a=4 order by b desc;
|
|
|
|
# Final cleanup.
|
|
DROP TABLE foo; |