Commit 755a68fe authored by Rich Prohaska's avatar Rich Prohaska

refs #6022 cardinality tests for mysql

git-svn-id: file:///svn/mysql/tests/mysql-test@53944 c7de825b-a66e-492c-adef-691d508d4ae1
parent 6d78e802
drop table if exists tt;
create table tt (a int, b int);
insert into tt values (1,0),(2,1),(3,2),(4,3);
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
analyze table tt;
Table Op Msg_type Msg_text
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
drop table tt;
drop table if exists tt;
create table tt (a int, b int, primary key(a));
insert into tt values (1,0),(2,1),(3,2),(4,3);
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
tt 0 PRIMARY 1 a A 4 NULL NULL BTREE
analyze table tt;
Table Op Msg_type Msg_text
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
tt 0 PRIMARY 1 a A 4 NULL NULL BTREE
flush tables;
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
tt 0 PRIMARY 1 a A 4 NULL NULL BTREE
drop table tt;
drop table if exists tt;
create table tt (a int, b int, primary key(a,b));
insert into tt values (0,0),(0,1),(1,0),(1,1);
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
tt 0 PRIMARY 1 a A NULL NULL NULL BTREE
tt 0 PRIMARY 2 b A 4 NULL NULL BTREE
analyze table tt;
Table Op Msg_type Msg_text
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
tt 0 PRIMARY 1 a A 2 NULL NULL BTREE
tt 0 PRIMARY 2 b A 4 NULL NULL BTREE
flush tables;
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
tt 0 PRIMARY 1 a A 2 NULL NULL BTREE
tt 0 PRIMARY 2 b A 4 NULL NULL BTREE
drop table tt;
This source diff could not be displayed because it is too large. You can view the blob instead.
drop table if exists tt;
create table tt (a int, b int, key(b));
insert into tt values (1,0),(2,1),(3,2),(4,3);
insert into tt values (5,0),(6,1),(7,2),(8,3);
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
tt 1 b 1 b A NULL NULL NULL YES BTREE
analyze table tt;
Table Op Msg_type Msg_text
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
tt 1 b 1 b A 4 NULL NULL YES BTREE
flush tables;
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
tt 1 b 1 b A 4 NULL NULL YES BTREE
drop table tt;
drop table if exists tt;
create table tt (a int, b int, key(a,b));
insert into tt values (0,0),(0,1),(1,0),(1,1);
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
tt 1 a 1 a A NULL NULL NULL YES BTREE
tt 1 a 2 b A NULL NULL NULL YES BTREE
analyze table tt;
Table Op Msg_type Msg_text
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
tt 1 a 1 a A 2 NULL NULL YES BTREE
tt 1 a 2 b A 4 NULL NULL YES BTREE
flush tables;
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
tt 1 a 1 a A 2 NULL NULL YES BTREE
tt 1 a 2 b A 4 NULL NULL YES BTREE
drop table tt;
drop table if exists tt;
create table tt (a int, b int, unique key(a));
insert into tt values (1,0),(2,1),(3,2),(4,3);
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
tt 0 a 1 a A 4 NULL NULL YES BTREE
analyze table tt;
Table Op Msg_type Msg_text
test.tt analyze status OK
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
tt 0 a 1 a A 4 NULL NULL YES BTREE
flush tables;
show indexes from tt;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
tt 0 a 1 a A 4 NULL NULL YES BTREE
drop table tt;
source include/have_tokudb.inc;
disable_warnings;
drop table if exists tt;
enable_warnings;
create table tt (a int, b int);
insert into tt values (1,0),(2,1),(3,2),(4,3);
show indexes from tt;
analyze table tt;
show indexes from tt;
drop table tt;
source include/have_tokudb.inc;
disable_warnings;
drop table if exists tt;
enable_warnings;
create table tt (a int, b int, primary key(a));
insert into tt values (1,0),(2,1),(3,2),(4,3);
# test that analyze computes the correct cardinality for the PK
show indexes from tt;
analyze table tt;
show indexes from tt;
# test that cardinality is persistent
flush tables;
show indexes from tt;
drop table tt;
source include/have_tokudb.inc;
disable_warnings;
drop table if exists tt;
enable_warnings;
create table tt (a int, b int, primary key(a,b));
insert into tt values (0,0),(0,1),(1,0),(1,1);
# test that analyze computes the correct cardinality for the PK
show indexes from tt;
analyze table tt;
show indexes from tt;
# test that cardinality is persistent
flush tables;
show indexes from tt;
drop table tt;
source include/have_tokudb.inc;
disable_warnings;
drop table if exists tt;
enable_warnings;
create table tt (a int, b int, primary key(a), key(b));
let $i=0;
while ($i < 1000) {
let $a=4*$i;
eval insert into tt values ($a,$a+1),($a+1,$a+2),($a+2,$a+3),($a+3,$a+4);
inc $i;
}
# test that analyze computes the correct cardinality for the keys
show indexes from tt;
analyze table tt;
show indexes from tt;
# test that cardinality is persistent
flush tables;
show indexes from tt;
drop table tt;
create table tt (a int, b int, primary key(a), key(b));
let $i=0;
while ($i < 1000) {
let $a=4*$i;
eval insert into tt values ($a,0),($a+1,0),($a+2,0),($a+3,0);
inc $i;
}
# test that analyze computes the correct cardinality for the keys
show indexes from tt;
analyze table tt;
show indexes from tt;
# test that cardinality is persistent
flush tables;
show indexes from tt;
drop table tt;
source include/have_tokudb.inc;
disable_warnings;
drop table if exists tt;
enable_warnings;
create table tt (a int, b int, key(b));
insert into tt values (1,0),(2,1),(3,2),(4,3);
insert into tt values (5,0),(6,1),(7,2),(8,3);
# test that analyze computes the correct cardinality for the SK
show indexes from tt;
analyze table tt;
show indexes from tt;
# test that cardinality is persistent
flush tables;
show indexes from tt;
drop table tt;
source include/have_tokudb.inc;
disable_warnings;
drop table if exists tt;
enable_warnings;
create table tt (a int, b int, key(a,b));
insert into tt values (0,0),(0,1),(1,0),(1,1);
# test that analyze computes the correct cardinality for the SK
show indexes from tt;
analyze table tt;
show indexes from tt;
# test that cardinality is persistent
flush tables;
show indexes from tt;
drop table tt;
source include/have_tokudb.inc;
disable_warnings;
drop table if exists tt;
enable_warnings;
create table tt (a int, b int, unique key(a));
insert into tt values (1,0),(2,1),(3,2),(4,3);
# test that analyze computes the correct cardinality for the unique SK
show indexes from tt;
analyze table tt;
show indexes from tt;
# test that cardinality is persistent
flush tables;
show indexes from tt;
drop table tt;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment