mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
WL#3527: Extend IGNORE INDEX so places where index is ignored
can be specified Currently MySQL allows one to specify what indexes to ignore during join optimization. The scope of the current USE/FORCE/IGNORE INDEX statement is only the FROM clause, while all other clauses are not affected. However, in certain cases, the optimizer may incorrectly choose an index for sorting and/or grouping, and produce an inefficient query plan. This task provides the means to specify what indexes are ignored/used for what operation in a more fine-grained manner, thus making it possible to manually force a better plan. We do this by extending the current IGNORE/USE/FORCE INDEX syntax to: IGNORE/USE/FORCE INDEX [FOR {JOIN | ORDER | GROUP BY}] so that: - if no FOR is specified, the index hint will apply everywhere. - if MySQL is started with the compatibility option --old_mode then an index hint without a FOR clause works as in 5.0 (i.e, the index will only be ignored for JOINs, but can still be used to compute ORDER BY). See the WL#3527 for further details. BitKeeper/deleted/.del-mysqld.cc.rej: Rename: sql/mysqld.cc.rej -> BitKeeper/deleted/.del-mysqld.cc.rej BitKeeper/deleted/.del-sql_parse.cc.rej: Rename: sql/sql_parse.cc.rej -> BitKeeper/deleted/.del-sql_parse.cc.rej BitKeeper/deleted/.del-table.cc.rej: Rename: sql/table.cc.rej -> BitKeeper/deleted/.del-table.cc.rej mysql-test/r/endspace.result: WL3527 : fixed undeterministic test mysql-test/r/group_by.result: WL#3527: test cases mysql-test/t/endspace.test: WL3527 : fixed undeterministic test mysql-test/t/group_by.test: WL#3527: test cases sql/item.cc: WL#3527: renames sql/mysql_priv.h: WL#3527: corrected initialization sql/mysqld.cc: WL#3527: added old_mode command line option sql/opt_range.cc: WL#3527: renames sql/sql_base.cc: WL#3527: - renames - correct initialization - extended the processing of USE/FORCE/IGNORE index sql/sql_class.h: WL#3527: added old_mode command line option sql/sql_delete.cc: WL#3527: renames sql/sql_help.cc: WL#3527: renames sql/sql_lex.cc: WL#3527: extended parsing of USE/FORCE/IGNORE index sql/sql_lex.h: WL#3527: extended parsing of USE/FORCE/IGNORE index sql/sql_parse.cc: WL#3527: extended parsing of USE/FORCE/IGNORE index sql/sql_select.cc: WL#3527: - renames - passing additional info to support the extended USE/FORCE/IGNORE INDEX syntax - If there is a covering index, and we have IGNORE INDEX FOR GROUP/ORDER, and this index is used for the JOIN part, then we have to ignore the IGNORE INDEX FOR GROUP/ORDER. sql/sql_show.cc: WL#3527: passing additional info to support the extended USE/FORCE/IGNORE INDEX syntax sql/sql_update.cc: WL#3527: renames sql/sql_yacc.yy: WL#3527: extended parsing of USE/FORCE/IGNORE index sql/table.cc: WL#3527: extended the processing of USE/FORCE/IGNORE index sql/table.h: WL#3527: extended the processing of USE/FORCE/IGNORE index storage/myisam/ha_myisam.cc: WL#3527: extended the processing of USE/FORCE/IGNORE index
This commit is contained in:
@ -25,10 +25,11 @@ insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
|
||||
select * from t1 ignore key (key1) where text1='teststring' or
|
||||
text1 like 'teststring_%' ORDER BY text1;
|
||||
text1
|
||||
teststring
|
||||
teststring
|
||||
teststring
|
||||
select * from t1 where text1='teststring' or text1 like 'teststring_%';
|
||||
text1
|
||||
teststring
|
||||
@ -48,10 +49,11 @@ alter table t1 modify text1 char(32) binary not null;
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
|
||||
select * from t1 ignore key (key1) where text1='teststring' or
|
||||
text1 like 'teststring_%' ORDER BY text1;
|
||||
text1
|
||||
teststring
|
||||
teststring
|
||||
teststring
|
||||
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
|
||||
concat('|', text1, '|')
|
||||
|teststring |
|
||||
@ -132,10 +134,11 @@ concat('|', text1, '|')
|
||||
drop table t1;
|
||||
create table t1 (text1 varchar(32) not NULL, KEY key1 using BTREE (text1)) engine=heap;
|
||||
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
|
||||
select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
|
||||
select * from t1 ignore key (key1) where text1='teststring' or
|
||||
text1 like 'teststring_%' ORDER BY text1;
|
||||
text1
|
||||
teststring
|
||||
teststring
|
||||
teststring
|
||||
select * from t1 where text1='teststring' or text1 like 'teststring_%';
|
||||
text1
|
||||
teststring
|
||||
|
Reference in New Issue
Block a user