mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +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:
@@ -120,16 +120,16 @@ def db_datadict my_idx2 db_datadict t1 UNIQUE
|
||||
def db_datadict PRIMARY db_datadict t1 PRIMARY KEY
|
||||
def db_datadict PRIMARY db_datadict t2 PRIMARY KEY
|
||||
SHOW INDEXES FROM db_datadict.t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t1 0 PRIMARY 1 f1 ### ### ### ### ### ### ###
|
||||
t1 0 PRIMARY 2 f2 ### ### ### ### ### ### ###
|
||||
t1 0 my_idx1 1 f6 ### ### ### ### ### ### ###
|
||||
t1 0 my_idx1 2 f1 ### ### ### ### ### ### ###
|
||||
t1 0 my_idx2 1 f3 ### ### ### ### ### ### ###
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
|
||||
t1 0 PRIMARY 1 f1 ### ### ### ### ### ### ### NO
|
||||
t1 0 PRIMARY 2 f2 ### ### ### ### ### ### ### NO
|
||||
t1 0 my_idx1 1 f6 ### ### ### ### ### ### ### NO
|
||||
t1 0 my_idx1 2 f1 ### ### ### ### ### ### ### NO
|
||||
t1 0 my_idx2 1 f3 ### ### ### ### ### ### ### NO
|
||||
SHOW INDEXES FROM db_datadict.t2;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t2 0 PRIMARY 1 f1 ### ### ### ### ### ### ###
|
||||
t2 0 PRIMARY 2 f2 ### ### ### ### ### ### ###
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
|
||||
t2 0 PRIMARY 1 f1 ### ### ### ### ### ### ### NO
|
||||
t2 0 PRIMARY 2 f2 ### ### ### ### ### ### ### NO
|
||||
connect testuser1, localhost, testuser1, , db_datadict;
|
||||
SHOW GRANTS FOR 'testuser1'@'localhost';
|
||||
Grants for testuser1@localhost
|
||||
@@ -143,12 +143,12 @@ def db_datadict my_idx1 db_datadict t1 UNIQUE
|
||||
def db_datadict my_idx2 db_datadict t1 UNIQUE
|
||||
def db_datadict PRIMARY db_datadict t1 PRIMARY KEY
|
||||
SHOW INDEXES FROM db_datadict.t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t1 0 PRIMARY 1 f1 ### ### ### ### ### ### ###
|
||||
t1 0 PRIMARY 2 f2 ### ### ### ### ### ### ###
|
||||
t1 0 my_idx1 1 f6 ### ### ### ### ### ### ###
|
||||
t1 0 my_idx1 2 f1 ### ### ### ### ### ### ###
|
||||
t1 0 my_idx2 1 f3 ### ### ### ### ### ### ###
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
|
||||
t1 0 PRIMARY 1 f1 ### ### ### ### ### ### ### NO
|
||||
t1 0 PRIMARY 2 f2 ### ### ### ### ### ### ### NO
|
||||
t1 0 my_idx1 1 f6 ### ### ### ### ### ### ### NO
|
||||
t1 0 my_idx1 2 f1 ### ### ### ### ### ### ### NO
|
||||
t1 0 my_idx2 1 f3 ### ### ### ### ### ### ### NO
|
||||
SHOW INDEXES FROM db_datadict.t2;
|
||||
ERROR 42000: SELECT command denied to user 'testuser1'@'localhost' for table 't2'
|
||||
connection default;
|
||||
|
Reference in New Issue
Block a user