mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 10:14:19 +01:00
DB-757 compute cardinality when alter table analyze partition is run
This commit is contained in:
parent
0a4446d72b
commit
b26799dcc7
3 changed files with 77 additions and 1 deletions
|
@ -0,0 +1,50 @@
|
|||
set default_storage_engine='tokudb';
|
||||
drop table if exists t;
|
||||
create table t (id int, x int, y int, primary key (id), key (x), key (y))
|
||||
partition by range(id)
|
||||
( partition p0 values less than (10), partition p1 values less than maxvalue);
|
||||
insert into t values (1,1,1),(2,1,2),(3,1,3),(4,1,4);
|
||||
show indexes from t;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t 0 PRIMARY 1 id A 5 NULL NULL BTREE
|
||||
t 1 x 1 x A NULL NULL NULL YES BTREE
|
||||
t 1 y 1 y A NULL NULL NULL YES BTREE
|
||||
alter table t analyze partition p0;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t analyze status OK
|
||||
show indexes from t;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t 0 PRIMARY 1 id A 5 NULL NULL BTREE
|
||||
t 1 x 1 x A 1 NULL NULL YES BTREE
|
||||
t 1 y 1 y A 5 NULL NULL YES BTREE
|
||||
alter table t analyze partition p1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t analyze status OK
|
||||
show indexes from t;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t 0 PRIMARY 1 id A 5 NULL NULL BTREE
|
||||
t 1 x 1 x A 1 NULL NULL YES BTREE
|
||||
t 1 y 1 y A 5 NULL NULL YES BTREE
|
||||
insert into t values (100,1,1),(200,2,1),(300,3,1),(400,4,1),(500,5,1);
|
||||
show indexes from t;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t 0 PRIMARY 1 id A 9 NULL NULL BTREE
|
||||
t 1 x 1 x A 2 NULL NULL YES BTREE
|
||||
t 1 y 1 y A 9 NULL NULL YES BTREE
|
||||
alter table t analyze partition p0;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t analyze status OK
|
||||
show indexes from t;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t 0 PRIMARY 1 id A 9 NULL NULL BTREE
|
||||
t 1 x 1 x A NULL NULL NULL YES BTREE
|
||||
t 1 y 1 y A NULL NULL NULL YES BTREE
|
||||
alter table t analyze partition p1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t analyze status OK
|
||||
show indexes from t;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t 0 PRIMARY 1 id A 9 NULL NULL BTREE
|
||||
t 1 x 1 x A 9 NULL NULL YES BTREE
|
||||
t 1 y 1 y A 1 NULL NULL YES BTREE
|
||||
drop table t;
|
26
mysql-test/suite/tokudb.bugs/t/db757_part_alter_analyze.test
Normal file
26
mysql-test/suite/tokudb.bugs/t/db757_part_alter_analyze.test
Normal file
|
@ -0,0 +1,26 @@
|
|||
source include/have_tokudb.inc;
|
||||
source include/have_partition.inc;
|
||||
set default_storage_engine='tokudb';
|
||||
disable_warnings;
|
||||
drop table if exists t;
|
||||
enable_warnings;
|
||||
|
||||
create table t (id int, x int, y int, primary key (id), key (x), key (y))
|
||||
partition by range(id)
|
||||
( partition p0 values less than (10), partition p1 values less than maxvalue);
|
||||
|
||||
insert into t values (1,1,1),(2,1,2),(3,1,3),(4,1,4);
|
||||
show indexes from t;
|
||||
alter table t analyze partition p0;
|
||||
show indexes from t;
|
||||
alter table t analyze partition p1;
|
||||
show indexes from t;
|
||||
|
||||
insert into t values (100,1,1),(200,2,1),(300,3,1),(400,4,1),(500,5,1);
|
||||
show indexes from t;
|
||||
alter table t analyze partition p0;
|
||||
show indexes from t;
|
||||
alter table t analyze partition p1;
|
||||
show indexes from t;
|
||||
|
||||
drop table t;
|
|
@ -133,7 +133,7 @@ int ha_tokudb::analyze(THD *thd, HA_CHECK_OPT *check_opt) {
|
|||
int result = HA_ADMIN_OK;
|
||||
|
||||
// stub out analyze if optimize is remapped to alter recreate + analyze
|
||||
if (thd_sql_command(thd) != SQLCOM_ANALYZE) {
|
||||
if (thd_sql_command(thd) != SQLCOM_ANALYZE && thd_sql_command(thd) != SQLCOM_ALTER_TABLE) {
|
||||
TOKUDB_HANDLER_DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue