mariadb/mysql-test/t/endspace.test
unknown 79542930ea 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
2007-03-05 19:08:41 +02:00

101 lines
4.1 KiB
Text

#
# Test problem with characters < ' ' at end of strings (Bug #3152)
#
-- source include/have_innodb.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
-- source include/endspace.inc
#
# Test MyISAM tables.
#
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1));
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
check table t1;
select * from t1 ignore key (key1) where text1='teststring' or
text1 like 'teststring_%' ORDER BY text1;
select * from t1 where text1='teststring' or text1 like 'teststring_%';
select * from t1 where text1='teststring' or text1 > 'teststring\t';
select * from t1 order by text1;
explain select * from t1 order by text1;
alter table t1 modify text1 char(32) binary not null;
check table t1;
select * from t1 ignore key (key1) where text1='teststring' or
text1 like 'teststring_%' ORDER BY text1;
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
select text1, length(text1) from t1 order by text1;
select text1, length(text1) from t1 order by binary text1;
alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20));
insert into t1 values ('teststring ');
select concat('|', text1, '|') from t1 order by text1;
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
select concat('|', text1, '|') from t1 where text1='teststring';
select concat('|', text1, '|') from t1 where text1='teststring ';
alter table t1 modify text1 text not null, pack_keys=1;
select concat('|', text1, '|') from t1 where text1='teststring';
select concat('|', text1, '|') from t1 where text1='teststring ';
explain select concat('|', text1, '|') from t1 where text1='teststring ';
select concat('|', text1, '|') from t1 where text1 like 'teststring_%';
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
select concat('|', text1, '|') from t1 order by text1;
drop table t1;
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) pack_keys=0;
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
select concat('|', text1, '|') from t1 where text1='teststring' or text1 >= 'teststring\t';
drop table t1;
# Test HEAP tables (with BTREE keys)
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_%' ORDER BY text1;
select * from t1 where text1='teststring' or text1 like 'teststring_%';
select * from t1 where text1='teststring' or text1 >= 'teststring\t';
select * from t1 order by text1;
explain select * from t1 order by text1;
alter table t1 modify text1 char(32) binary not null;
select * from t1 order by text1;
drop table t1;
#
# Test InnoDB tables
#
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) engine=innodb;
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
check table t1;
select * from t1 where text1='teststring' or text1 like 'teststring_%';
select * from t1 where text1='teststring' or text1 > 'teststring\t';
select * from t1 order by text1;
explain select * from t1 order by text1;
alter table t1 modify text1 char(32) binary not null;
select * from t1 order by text1;
alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20));
insert into t1 values ('teststring ');
select concat('|', text1, '|') from t1 order by text1;
alter table t1 modify text1 text not null, pack_keys=1;
select * from t1 where text1 like 'teststring_%';
# The following gives wrong result in InnoDB
select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%';
select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t';
select concat('|', text1, '|') from t1 order by text1;
drop table t1;
# End of 4.1 tests