mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-7317: Make an index ignorable to the optimizer
This feature adds the functionality of ignorability for indexes. Indexes are not ignored be default. To control index ignorability explicitly for a new index, use IGNORE or NOT IGNORE as part of the index definition for CREATE TABLE, CREATE INDEX, or ALTER TABLE. Primary keys (explicit or implicit) cannot be made ignorable. The table INFORMATION_SCHEMA.STATISTICS get a new column named IGNORED that would store whether an index needs to be ignored or not.
This commit is contained in:
@ -82,6 +82,7 @@ Null YES
|
||||
Index_type HASH
|
||||
Comment
|
||||
Index_comment
|
||||
Ignored NO
|
||||
insert into t1 values(1,1);
|
||||
ERROR 23000: Duplicate entry '1' for key 'a'
|
||||
DROP TABLE t1;
|
||||
@ -128,6 +129,7 @@ Null
|
||||
Index_type BTREE
|
||||
Comment
|
||||
Index_comment
|
||||
Ignored NO
|
||||
ALTER TABLE t1 ADD INDEX (pk);
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (b int, a varchar(4000));
|
||||
@ -280,14 +282,14 @@ DROP TABLE t1, t2;
|
||||
SET binlog_row_image= FULL;
|
||||
CREATE TABLE t1 (a int, b VARCHAR(1000), UNIQUE (a,b)) ENGINE=MyISAM;
|
||||
show index from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t1 0 a 1 a A NULL NULL NULL YES HASH
|
||||
t1 0 a 2 b A NULL NULL NULL YES HASH
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
|
||||
t1 0 a 1 a A NULL NULL NULL YES HASH NO
|
||||
t1 0 a 2 b A NULL NULL NULL YES HASH NO
|
||||
CREATE TABLE t2 (a varchar(900), b VARCHAR(900), UNIQUE (a,b)) ENGINE=MyISAM;
|
||||
show index from t2;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t2 0 a 1 a A NULL NULL NULL YES HASH
|
||||
t2 0 a 2 b A NULL NULL NULL YES HASH
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
|
||||
t2 0 a 1 a A NULL NULL NULL YES HASH NO
|
||||
t2 0 a 2 b A NULL NULL NULL YES HASH NO
|
||||
DROP TABLE t1,t2;
|
||||
create temporary table tmp ( a int, b int, c blob not null, d int, e int default 0, f int, unique key (c)) engine=innodb;
|
||||
create table t2 (x int);
|
||||
|
Reference in New Issue
Block a user