mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
This changeset belongs to
WL#3397 Refactoring storage engine test cases (for falcon) It contains also fixes according to code review. Contents: Testcases which were in history dedicated to InnoDB or MyISAM only. Modifications: 1. Shift the main testing code into include/<testing field>.inc Introduce $variables which can be used to omit tests for features which are not supported by certain storage engines. 2. The storage engine to be tested is assigned within the toplevel script (t/<whatever>_<engine>.test) via variable $engine_type and the the main testing code is sourced from include/<testing field>.inc 3. Some toplevel testscripts have to be renamed to - avoid immediate or future namespace clashes - show via filename which storage engine is tested 4. Minor code cleanup like remove trailing spaces, some additional comments .... mysql-test/t/unsafe_binlog_innodb-master.opt: Rename: mysql-test/t/innodb_unsafe_binlog-master.opt -> mysql-test/t/unsafe_binlog_innodb-master.opt mysql-test/r/read_many_rows_innodb.result: Rename: mysql-test/r/innodb-big.result -> mysql-test/r/read_many_rows_innodb.result mysql-test/t/cache_innodb-master.opt: Rename: mysql-test/t/innodb_cache-master.opt -> mysql-test/t/cache_innodb-master.opt mysql-test/t/concurrent_innodb-master.opt: Rename: mysql-test/t/innodb_concurrent-master.opt -> mysql-test/t/concurrent_innodb-master.opt BitKeeper/deleted/.del-index_merge.result: Delete: mysql-test/r/index_merge.result BitKeeper/deleted/.del-index_merge_innodb.result: Delete: mysql-test/r/index_merge_innodb.result BitKeeper/deleted/.del-index_merge_innodb2.result: Delete: mysql-test/r/index_merge_innodb2.result BitKeeper/deleted/.del-index_merge_ror.result: Delete: mysql-test/r/index_merge_ror.result BitKeeper/deleted/.del-index_merge_ror_cpk.result: Delete: mysql-test/r/index_merge_ror_cpk.result mysql-test/r/index_merge_innodb.result: BitKeeper file /home/matthias/Arbeit/mysql-5.1-engines/src-1/mysql-test/r/index_merge_innodb.result mysql-test/t/index_merge_innodb.test: BitKeeper file /home/matthias/Arbeit/mysql-5.1-engines/src-1/mysql-test/t/index_merge_innodb.test mysql-test/t/index_merge_myisam.test: BitKeeper file /home/matthias/Arbeit/mysql-5.1-engines/src-1/mysql-test/t/index_merge_myisam.test mysql-test/include/concurrent.inc: 1. This file contains now the main testing code of the former t/innodb_concurrent.test. 2. It is now sourced by t/concurrent_innodb.test. mysql-test/include/deadlock.inc: 1. This file contains now the main testing code of the former t/innodb-deadlock.test 2. It is now sourced by t/deadlock_innodb.test. mysql-test/include/handler.inc: 1. This file contains now the main testing code of the former t/innodb_handler.test + t/handler.test. 2. It is now sourced by t/handler_myisam.test and t/handler_innodb.test. mysql-test/include/index_merge1.inc: 1. This file contains now the main testing code of the former t/index_merge.test. 2. It is now sourced by t/index_merge_myisam.test. mysql-test/include/index_merge2.inc: 1. This file contains now the main code of t/index_merge_innodb.test. 2. It is sourced by t/index_merge_myisam.test and t/index_merge_innodb.test. mysql-test/include/index_merge_2sweeps.inc: 1. This file contains now the main code of the former t/index_merge_innodb2.test. 2. It is sourced by t/index_merge_myisam.test and t/index_merge_innodb.test. mysql-test/include/index_merge_ror.inc: 1. This file contains now the main code of the former t/index_merge_ror.test. 2. It is sourced by t/index_merge_myisam.test. mysql-test/include/index_merge_ror_cpk.inc: 1. This file contains now the main testing code of the former t/index_merge_ror_cpk.test. 2. It is now sourced by t/index_merge_myisam.test and t/index_merge_innodb.test. mysql-test/include/mix1.inc: 1. This file contains now the main testing code of the t/innodb_mysql.test 2. The name mix1.inc was used because the test contains subtests for different fields. 3. It is sourced by t/innodb_mysql.test. 4. Fixes: - Assign $other_engine_type instead of hardcoded MyISAM. - improve comment - remove redundant subtest - analyze table t4 instead of wrong table t1 - remove not needed "eval set storage_engine = $engine_type;" mysql-test/include/mix2.inc: 1. This file is a copy of the main testing code of the t/innodb.test A copy has to be used, because t/innodb.test is to be maintained by INNOBASE only. 2. The name mix2.inc was used because the test contains subtests for different fields. 3. It is sourced by t/mix2_myisam.test. 4. Fixes: - improved comment - additional "eval SET SESSION STORAGE_ENGINE = $other_engine_type;" at beginning of tests - assign $other_engine_type instead of hardcoded MyISAM or HEAP - assign $other_engine_type where it is needed to preserve test logics - correct logical bugs - improve(extend) "checksum table" test mysql-test/include/query_cache.inc: 1. This file contains now the main testing code of the former t/innodb_cache.test. 2. It is now sourced by t/cache_innodb.test mysql-test/include/read_many_rows.inc: 1. This file contains now the main testing code of the former t/innodb_big.test. 2. It is now sourced by t/read_many_rows_innodb.test. mysql-test/include/rowid_order.inc: 1. This file contains now the main testing code of t/rowid_order_innodb.test. 2. It is now sourced by t/rowid_order_innodb.test. mysql-test/include/unsafe_binlog.inc: 1. This file contains now the main testing code of the former t/innodb_unsafe_binlog.test. 2. It is now sourced by t/unsafe_binlog_innodb.test. mysql-test/r/cache_innodb.result: Updated result mysql-test/r/concurrent_innodb.result: Updated result mysql-test/r/deadlock_innodb.result: Updated result mysql-test/r/handler_innodb.result: Updated result mysql-test/r/handler_myisam.result: Updated result mysql-test/r/index_merge_myisam.result: Updated result mysql-test/r/innodb_mysql.result: Updated result mysql-test/r/mix2_myisam.result: Updated result mysql-test/r/rowid_order_innodb.result: Updated result mysql-test/r/unsafe_binlog_innodb.result: Updated result mysql-test/t/cache_innodb.test: 1. Renaming of t/innodb_cache.test to t/cache_innodb.test 2. Main code is now sourced from include/query_cache.inc. mysql-test/t/concurrent_innodb.test: 1. Renaming of t/innodb_concurrent.test to t/concurrent_innodb.test 2. Main code is now sourced from include/concurrent.inc. Attention: This test fails even in the old version. (BUG#21579). --> added to t/disabled.def mysql-test/t/deadlock_innodb.test: 1. Renaming of t/innodb_deadlock.test to t/deadlock_innodb.test 2. Main code is now sourced from include/deadlock.inc. mysql-test/t/disabled.def: Add the test concurrent_innodb because of BUG#21579 2006-08-11 mleich innodb_concurrent random failures with varying differences mysql-test/t/handler_innodb.test: 1. Renaming of t/innodb_handler.test to t/handler_innodb.test 2. Main code is now sourced from include/handler.inc. include/handler.inc = united code of former t/handler.test and t/innodb_handler.test mysql-test/t/handler_myisam.test: 1. Renaming of t/handler.test to t/handler_myisam.test 2. Main code is now sourced from include/handler.inc. include/handler.inc = united code of former t/handler.test and t/handler_innodb.test. mysql-test/t/innodb_mysql.test: 1. Main code is now sourced from include/mix1.inc. 2. Test was not renamed because t/innodb.test refers to it. mysql-test/t/mix2_myisam.test: New test: MyISAM variant of mix2 ( = t/innodb.test) mysql-test/t/read_many_rows_innodb.test: 1. Renaming of t/innodb_big.test to t/read_many_rows_innodb.test 2. Main code is now sourced from include/read_many_rows.inc. mysql-test/t/rowid_order_innodb.test: Main code is now sourced from t/rowid_order.inc. mysql-test/t/unsafe_binlog_innodb.test: 1. Renaming of t/innodb_unsafe_binlog.test to t/unsafe_binlog_innodb.test 2. Main code is now sourced from include/unsafe_binlog.inc.
This commit is contained in:
parent
829d70d09c
commit
808237b083
49 changed files with 8749 additions and 2321 deletions
|
@ -1,19 +1,30 @@
|
|||
# include/concurrent.inc
|
||||
#
|
||||
# Concurrent InnoDB tests, mainly in UPDATE's
|
||||
# Concurrent tests for transactional storage engines, mainly in UPDATE's
|
||||
# Bug#3300
|
||||
# Designed and tested by Sinisa Milivojevic, sinisa@mysql.com
|
||||
#
|
||||
# two non-interfering UPDATE's not changing result set
|
||||
#
|
||||
|
||||
# test takes circa 5 minutes to run, so it's big
|
||||
-- source include/big_test.inc
|
||||
# The variable
|
||||
# $engine_type -- storage engine to be tested
|
||||
# has to be set before sourcing this script.
|
||||
#
|
||||
# Last update:
|
||||
# 2006-08-02 ML test refactored
|
||||
# old name was t/innodb_concurrent.test
|
||||
# main code went into include/concurrent.inc
|
||||
#
|
||||
|
||||
connection default;
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb;
|
||||
--enable_warnings
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
|
@ -57,7 +68,7 @@ drop table t1;
|
|||
#
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
|
@ -103,7 +114,7 @@ drop table t1;
|
|||
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1 (a int not null, b int not null) engine=innodb;
|
||||
create table t1 (a int not null, b int not null);
|
||||
insert into t1 values (1,1),(2,1),(3,1),(4,1);
|
||||
select get_lock("hello2",1000);
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
|
@ -132,7 +143,7 @@ drop table t1;
|
|||
#
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
|
@ -175,7 +186,7 @@ drop table t1;
|
|||
#
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
|
@ -218,7 +229,7 @@ drop table t1;
|
|||
#
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
|
@ -261,7 +272,7 @@ drop table t1;
|
|||
#
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
|
@ -305,7 +316,7 @@ drop table t1;
|
|||
#
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) engine=innodb;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
147
mysql-test/include/deadlock.inc
Normal file
147
mysql-test/include/deadlock.inc
Normal file
|
@ -0,0 +1,147 @@
|
|||
# include/deadlock.inc
|
||||
#
|
||||
# The variable
|
||||
# $engine_type -- storage engine to be tested
|
||||
# has to be set before sourcing this script.
|
||||
#
|
||||
# Last update:
|
||||
# 2006-07-26 ML refactoring + print when connection is switched
|
||||
# old name was t/innodb-deadlock.test
|
||||
# main code went into include/deadlock.inc
|
||||
#
|
||||
|
||||
--echo # Establish connection con1 (user=root)
|
||||
connect (con1,localhost,root,,);
|
||||
--echo # Establish connection con2 (user=root)
|
||||
connect (con2,localhost,root,,);
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Testing of FOR UPDATE
|
||||
#
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
eval create table t1 (id integer, x integer) engine = $engine_type;
|
||||
insert into t1 values(0, 0);
|
||||
set autocommit=0;
|
||||
SELECT * from t1 where id = 0 FOR UPDATE;
|
||||
|
||||
--echo # Switch to connection con2
|
||||
connection con2;
|
||||
set autocommit=0;
|
||||
|
||||
# The following query should hang because con1 is locking the record
|
||||
--send
|
||||
update t1 set x=2 where id = 0;
|
||||
--sleep 2
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
--echo # Switch to connection con2
|
||||
connection con2;
|
||||
reap;
|
||||
commit;
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
drop table t1;
|
||||
#
|
||||
# Testing of FOR UPDATE
|
||||
#
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
eval create table t1 (id integer, x integer) engine = $engine_type;
|
||||
eval create table t2 (b integer, a integer) engine = $engine_type;
|
||||
insert into t1 values(0, 0), (300, 300);
|
||||
insert into t2 values(0, 10), (1, 20), (2, 30);
|
||||
commit;
|
||||
set autocommit=0;
|
||||
select * from t2;
|
||||
update t2 set a=100 where b=(SELECT x from t1 where id = b FOR UPDATE);
|
||||
select * from t2;
|
||||
select * from t1;
|
||||
|
||||
--echo # Switch to connection con2
|
||||
connection con2;
|
||||
set autocommit=0;
|
||||
|
||||
# The following query should hang because con1 is locking the record
|
||||
--send
|
||||
update t1 set x=2 where id = 0;
|
||||
--sleep 2
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
--echo # Switch to connection con2
|
||||
connection con2;
|
||||
reap;
|
||||
commit;
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
drop table t1, t2;
|
||||
eval create table t1 (id integer, x integer) engine = $engine_type;
|
||||
eval create table t2 (b integer, a integer) engine = $engine_type;
|
||||
insert into t1 values(0, 0), (300, 300);
|
||||
insert into t2 values(0, 0), (1, 20), (2, 30);
|
||||
commit;
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE;
|
||||
select * from t2;
|
||||
select * from t1;
|
||||
|
||||
--echo # Switch to connection con2
|
||||
connection con2;
|
||||
|
||||
# The following query should hang because con1 is locking the record
|
||||
update t2 set a=2 where b = 0;
|
||||
select * from t2;
|
||||
--send
|
||||
update t1 set x=2 where id = 0;
|
||||
--sleep 2
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
--echo # Switch to connection con2
|
||||
connection con2;
|
||||
reap;
|
||||
commit;
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
# Cleanup
|
||||
--echo # Switch to connection default + disconnect con1 and con2
|
||||
connection default;
|
||||
disconnect con1;
|
||||
disconnect con2;
|
||||
drop table t1, t2;
|
||||
|
||||
# End of 4.1 tests
|
|
@ -1,9 +1,18 @@
|
|||
# include/handler.inc
|
||||
#
|
||||
# The variable
|
||||
# $engine_type -- storage engine to be tested
|
||||
# has to be set before sourcing this script.
|
||||
#
|
||||
# test of HANDLER ...
|
||||
#
|
||||
# Last update:
|
||||
# 2006-07-31 ML test refactored (MySQL 5.1)
|
||||
# code of t/handler.test and t/innodb_handler.test united
|
||||
# main testing code put into include/handler.inc
|
||||
#
|
||||
|
||||
# should work in embedded server after mysqltest is fixed
|
||||
-- source include/not_embedded.inc
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t3,t4,t5;
|
||||
|
@ -73,6 +82,22 @@ handler t2 read next;
|
|||
handler t2 read last;
|
||||
handler t2 close;
|
||||
|
||||
handler t1 open;
|
||||
handler t1 read a next; # this used to crash as a bug#5373
|
||||
handler t1 read a next;
|
||||
handler t1 close;
|
||||
|
||||
handler t1 open;
|
||||
handler t1 read a prev; # this used to crash as a bug#5373
|
||||
handler t1 read a prev;
|
||||
handler t1 close;
|
||||
|
||||
handler t1 open as t2;
|
||||
handler t2 read first;
|
||||
eval alter table t1 engine = $engine_type;
|
||||
--error 1109
|
||||
handler t2 read first;
|
||||
|
||||
#
|
||||
# DROP TABLE / ALTER TABLE
|
||||
#
|
||||
|
@ -378,6 +403,13 @@ reap;
|
|||
connection default;
|
||||
drop table t1;
|
||||
|
||||
CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2));
|
||||
INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2);
|
||||
HANDLER t1 OPEN;
|
||||
HANDLER t1 READ `primary` = (1, 1000);
|
||||
HANDLER t1 READ `primary` PREV;
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
|
@ -1,6 +1,26 @@
|
|||
# include/index_merge1.inc
|
||||
#
|
||||
# Index merge tests
|
||||
#
|
||||
# The variables
|
||||
# $engine_type -- storage engine to be tested
|
||||
# $merge_table_support -- 1 storage engine supports merge tables
|
||||
# -- 0 storage engine does not support merge tables
|
||||
# have to be set before sourcing this script.
|
||||
#
|
||||
# Note: The comments/expectations refer to MyISAM.
|
||||
# They might be not valid for other storage engines.
|
||||
#
|
||||
# Last update:
|
||||
# 2006-08-02 ML test refactored
|
||||
# old name was t/index_merge.test
|
||||
# main code went into include/index_merge1.inc
|
||||
#
|
||||
|
||||
--echo #---------------- Index merge test 1 -------------------------------------------
|
||||
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t0, t1, t2, t3, t4;
|
||||
--enable_warnings
|
||||
|
@ -8,7 +28,7 @@ drop table if exists t0, t1, t2, t3, t4;
|
|||
# Create and fill a table with simple keys
|
||||
create table t0
|
||||
(
|
||||
key1 int not null,
|
||||
key1 int not null,
|
||||
INDEX i1(key1)
|
||||
);
|
||||
|
||||
|
@ -36,11 +56,11 @@ alter table t0 add key8 int not null, add index i8(key8);
|
|||
update t0 set key2=key1,key3=key1,key4=key1,key5=key1,key6=key1,key7=key1,key8=1024-key1;
|
||||
analyze table t0;
|
||||
|
||||
# 1. One index
|
||||
# 1. One index
|
||||
explain select * from t0 where key1 < 3 or key1 > 1020;
|
||||
|
||||
# 2. Simple cases
|
||||
explain
|
||||
explain
|
||||
select * from t0 where key1 < 3 or key2 > 1020;
|
||||
select * from t0 where key1 < 3 or key2 > 1020;
|
||||
|
||||
|
@ -48,6 +68,7 @@ explain select * from t0 where key1 < 3 or key2 <4;
|
|||
|
||||
explain
|
||||
select * from t0 where (key1 > 30 and key1<35) or (key2 >32 and key2 < 40);
|
||||
# Bug#21277: InnoDB, wrong result set, index_merge strategy, second index not evaluated
|
||||
select * from t0 where (key1 > 30 and key1<35) or (key2 >32 and key2 < 40);
|
||||
|
||||
# 3. Check that index_merge doesn't break "ignore/force/use index"
|
||||
|
@ -60,8 +81,8 @@ explain select * from t0 force index (i1,i2) where (key1 > 1 or key2 > 2);
|
|||
|
||||
|
||||
# 4. Check if conjuncts are grouped by keyuse
|
||||
explain
|
||||
select * from t0 where key1<3 or key2<3 or (key1>5 and key1<8) or
|
||||
explain
|
||||
select * from t0 where key1<3 or key2<3 or (key1>5 and key1<8) or
|
||||
(key1>10 and key1<12) or (key2>100 and key2<110);
|
||||
|
||||
# 5. Check index_merge with conjuncts that are always true/false
|
||||
|
@ -78,13 +99,13 @@ explain select * from t0 where key2=10 or key3=3 or key4 <=> null;
|
|||
explain select * from t0 where key2=10 or key3=3 or key4 is null;
|
||||
|
||||
# some more complicated cases
|
||||
explain select key1 from t0 where (key1 <=> null) or (key2 < 5) or
|
||||
explain select key1 from t0 where (key1 <=> null) or (key2 < 5) or
|
||||
(key3=10) or (key4 <=> null);
|
||||
explain select key1 from t0 where (key1 <=> null) or (key1 < 5) or
|
||||
explain select key1 from t0 where (key1 <=> null) or (key1 < 5) or
|
||||
(key3=10) or (key4 <=> null);
|
||||
|
||||
# 6.Several ways to do index_merge, (ignored) index_merge vs. range
|
||||
explain select * from t0 where
|
||||
explain select * from t0 where
|
||||
(key1 < 3 or key2 < 3) and (key3 < 4 or key4 < 4) and (key5 < 5 or key6 < 5);
|
||||
|
||||
explain
|
||||
|
@ -93,23 +114,23 @@ select * from t0 where (key1 < 3 or key2 < 6) and (key1 < 7 or key3 < 4);
|
|||
select * from t0 where (key1 < 3 or key2 < 6) and (key1 < 7 or key3 < 4);
|
||||
|
||||
|
||||
explain select * from t0 where
|
||||
explain select * from t0 where
|
||||
(key1 < 3 or key2 < 3) and (key3 < 4 or key4 < 4) and (key5 < 2 or key6 < 2);
|
||||
|
||||
|
||||
# now index_merge is not used at all when "range" is possible
|
||||
explain select * from t0 where
|
||||
explain select * from t0 where
|
||||
(key1 < 3 or key2 < 3) and (key3 < 100);
|
||||
|
||||
# this even can cause "all" scan:
|
||||
explain select * from t0 where
|
||||
(key1 < 3 or key2 < 3) and (key3 < 1000);
|
||||
|
||||
|
||||
|
||||
# 7. Complex cases
|
||||
# tree_or(List<SEL_IMERGE>, range SEL_TREE).
|
||||
explain select * from t0 where
|
||||
((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
|
||||
or
|
||||
explain select * from t0 where
|
||||
((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
|
||||
or
|
||||
key2 > 5;
|
||||
|
||||
explain select * from t0 where
|
||||
|
@ -121,18 +142,18 @@ select * from t0 where
|
|||
((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
|
||||
or
|
||||
key1 < 7;
|
||||
|
||||
# tree_or(List<SEL_IMERGE>, List<SEL_IMERGE>).
|
||||
explain select * from t0 where
|
||||
((key1 < 4 or key2 < 4) and (key3 <5 or key5 < 4))
|
||||
or
|
||||
|
||||
# tree_or(List<SEL_IMERGE>, List<SEL_IMERGE>).
|
||||
explain select * from t0 where
|
||||
((key1 < 4 or key2 < 4) and (key3 <5 or key5 < 4))
|
||||
or
|
||||
((key5 < 5 or key6 < 6) and (key7 <7 or key8 < 4));
|
||||
|
||||
explain select * from t0 where
|
||||
((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
|
||||
or
|
||||
((key7 <7 or key8 < 4) and (key5 < 5 or key6 < 6));
|
||||
|
||||
|
||||
explain select * from t0 where
|
||||
((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
|
||||
or
|
||||
|
@ -152,7 +173,7 @@ explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where
|
|||
((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
|
||||
or
|
||||
((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
|
||||
|
||||
|
||||
# 8. Verify that "order by" after index merge uses filesort
|
||||
select * from t0 where key1 < 5 or key8 < 4 order by key1;
|
||||
|
||||
|
@ -186,10 +207,8 @@ create table t4 (
|
|||
key2_1 int not null,
|
||||
key2_2 int not null,
|
||||
key3 int not null,
|
||||
|
||||
index i1a (key1a, key1b),
|
||||
index i1b (key1b, key1a),
|
||||
|
||||
index i2_1(key2, key2_1),
|
||||
index i2_2(key2, key2_1)
|
||||
);
|
||||
|
@ -197,8 +216,8 @@ create table t4 (
|
|||
insert into t4 select key1,key1,key1 div 10, key1 % 10, key1 % 10, key1 from t0;
|
||||
|
||||
# the following will be handled by index_merge:
|
||||
select * from t4 where key1a = 3 or key1b = 4;
|
||||
explain select * from t4 where key1a = 3 or key1b = 4;
|
||||
select * from t4 where key1a = 3 or key1b = 4;
|
||||
explain select * from t4 where key1a = 3 or key1b = 4;
|
||||
|
||||
# and the following will not
|
||||
explain select * from t4 where key2 = 1 and (key2_1 = 1 or key3 = 5);
|
||||
|
@ -213,27 +232,27 @@ create table t1 like t0;
|
|||
insert into t1 select * from t0;
|
||||
|
||||
# index_merge on first table in join
|
||||
explain select * from t0 left join t1 on (t0.key1=t1.key1)
|
||||
where t0.key1=3 or t0.key2=4;
|
||||
explain select * from t0 left join t1 on (t0.key1=t1.key1)
|
||||
where t0.key1=3 or t0.key2=4;
|
||||
|
||||
select * from t0 left join t1 on (t0.key1=t1.key1)
|
||||
where t0.key1=3 or t0.key2=4;
|
||||
|
||||
explain
|
||||
explain
|
||||
select * from t0,t1 where (t0.key1=t1.key1) and ( t0.key1=3 or t0.key2=4);
|
||||
|
||||
# index_merge vs. ref
|
||||
explain
|
||||
select * from t0,t1 where (t0.key1=t1.key1) and
|
||||
explain
|
||||
select * from t0,t1 where (t0.key1=t1.key1) and
|
||||
(t0.key1=3 or t0.key2=4) and t1.key1<200;
|
||||
|
||||
# index_merge vs. ref
|
||||
explain
|
||||
select * from t0,t1 where (t0.key1=t1.key1) and
|
||||
explain
|
||||
select * from t0,t1 where (t0.key1=t1.key1) and
|
||||
(t0.key1=3 or t0.key2<4) and t1.key1=2;
|
||||
|
||||
# index_merge on second table in join
|
||||
explain select * from t0,t1 where t0.key1 = 5 and
|
||||
explain select * from t0,t1 where t0.key1 = 5 and
|
||||
(t1.key1 = t0.key1 or t1.key8 = t0.key1);
|
||||
|
||||
# Fix for bug#1974
|
||||
|
@ -241,7 +260,7 @@ explain select * from t0,t1 where t0.key1 < 3 and
|
|||
(t1.key1 = t0.key1 or t1.key8 = t0.key1);
|
||||
|
||||
# index_merge inside union
|
||||
explain select * from t1 where key1=3 or key2=4
|
||||
explain select * from t1 where key1=3 or key2=4
|
||||
union select * from t1 where key1<4 or key3=5;
|
||||
|
||||
# index merge in subselect
|
||||
|
@ -256,21 +275,23 @@ alter table t3 add keyB int not null, add index iB(keyB);
|
|||
alter table t3 add keyC int not null, add index iC(keyC);
|
||||
update t3 set key9=key1,keyA=key1,keyB=key1,keyC=key1;
|
||||
|
||||
explain select * from t3 where
|
||||
explain select * from t3 where
|
||||
key1=1 or key2=2 or key3=3 or key4=4 or
|
||||
key5=5 or key6=6 or key7=7 or key8=8 or
|
||||
key9=9 or keyA=10 or keyB=11 or keyC=12;
|
||||
|
||||
|
||||
select * from t3 where
|
||||
key1=1 or key2=2 or key3=3 or key4=4 or
|
||||
key5=5 or key6=6 or key7=7 or key8=8 or
|
||||
key9=9 or keyA=10 or keyB=11 or keyC=12;
|
||||
key9=9 or keyA=10 or keyB=11 or keyC=12;
|
||||
|
||||
# Test for Bug#3183
|
||||
explain select * from t0 where key1 < 3 or key2 < 4;
|
||||
# Bug#21277: InnoDB, wrong result set, index_merge strategy, second index not evaluated
|
||||
select * from t0 where key1 < 3 or key2 < 4;
|
||||
|
||||
update t0 set key8=123 where key1 < 3 or key2 < 4;
|
||||
# Bug#21277: InnoDB, wrong result set, index_merge strategy, second index not evaluated
|
||||
select * from t0 where key1 < 3 or key2 < 4;
|
||||
|
||||
delete from t0 where key1 < 3 or key2 < 4;
|
||||
|
@ -283,47 +304,47 @@ create table t4 (a int);
|
|||
insert into t4 values (1),(4),(3);
|
||||
set @save_join_buffer_size=@@join_buffer_size;
|
||||
set join_buffer_size= 4000;
|
||||
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
|
||||
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
|
||||
where (A.key1 < 500000 or A.key2 < 3)
|
||||
and (B.key1 < 500000 or B.key2 < 3);
|
||||
|
||||
select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
|
||||
select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
|
||||
where (A.key1 < 500000 or A.key2 < 3)
|
||||
and (B.key1 < 500000 or B.key2 < 3);
|
||||
|
||||
update t0 set key1=1;
|
||||
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
|
||||
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
|
||||
where (A.key1 = 1 or A.key2 = 1)
|
||||
and (B.key1 = 1 or B.key2 = 1);
|
||||
|
||||
select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
|
||||
select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
|
||||
where (A.key1 = 1 or A.key2 = 1)
|
||||
and (B.key1 = 1 or B.key2 = 1);
|
||||
|
||||
alter table t0 add filler1 char(200), add filler2 char(200), add filler3 char(200);
|
||||
update t0 set key2=1, key3=1, key4=1, key5=1,key6=1,key7=1 where key7 < 500;
|
||||
|
||||
# The next query will not use index i7 in intersection if the OS doesn't
|
||||
# The next query will not use index i7 in intersection if the OS doesn't
|
||||
# support file sizes > 2GB. (ha_myisam::ref_length depends on this and index
|
||||
# scan cost estimates depend on ha_myisam::ref_length)
|
||||
--replace_column 9 #
|
||||
--replace_result "4,4,4,4,4,4,4" X "4,4,4,4,4,4" X "i6,i7" "i6,i7?" "i6" "i6,i7?"
|
||||
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
from t0 as A, t0 as B
|
||||
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
from t0 as A, t0 as B
|
||||
where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
|
||||
and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
|
||||
|
||||
select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
from t0 as A, t0 as B
|
||||
select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
from t0 as A, t0 as B
|
||||
where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
|
||||
and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
|
||||
|
||||
set join_buffer_size= @save_join_buffer_size;
|
||||
# Test for BUG#4177 ends
|
||||
# Test for BUG#4177 ends
|
||||
|
||||
drop table t0, t1, t2, t3, t4;
|
||||
|
||||
|
@ -357,13 +378,15 @@ explain select * from t1 WHERE cola = 'foo' AND colb = 'bar';
|
|||
explain select * from t1 force index(cola,colb) WHERE cola = 'foo' AND colb = 'bar';
|
||||
drop table t1;
|
||||
|
||||
if ($merge_table_support)
|
||||
{
|
||||
#
|
||||
# BUG#17314: Index_merge/intersection not choosen by the optimizer for MERGE tables
|
||||
#
|
||||
create table t0 (a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
create table t1 (
|
||||
a int, b int,
|
||||
a int, b int,
|
||||
filler1 char(200), filler2 char(200),
|
||||
key(a),key(b)
|
||||
);
|
||||
|
@ -371,7 +394,7 @@ insert into t1 select @v:= A.a, @v, 't1', 'filler2' from t0 A, t0 B, t0 C;
|
|||
create table t2 like t1;
|
||||
|
||||
create table t3 (
|
||||
a int, b int,
|
||||
a int, b int,
|
||||
filler1 char(200), filler2 char(200),
|
||||
key(a),key(b)
|
||||
) engine=merge union=(t1,t2);
|
||||
|
@ -383,3 +406,4 @@ explain select * from t3 where a=1 and b=1;
|
|||
|
||||
drop table t3;
|
||||
drop table t0, t1, t2;
|
||||
}
|
318
mysql-test/include/index_merge2.inc
Normal file
318
mysql-test/include/index_merge2.inc
Normal file
|
@ -0,0 +1,318 @@
|
|||
# include/index_merge2.inc
|
||||
#
|
||||
# Index merge tests
|
||||
#
|
||||
# The variable
|
||||
# $engine_type -- storage engine to be tested
|
||||
# has to be set before sourcing this script.
|
||||
#
|
||||
# Note: The comments/expectations refer to InnoDB.
|
||||
# They might be not valid for other storage engines.
|
||||
#
|
||||
# Last update:
|
||||
# 2006-08-02 ML test refactored
|
||||
# old name was t/index_merge_innodb.test
|
||||
# main code went into include/index_merge2.inc
|
||||
#
|
||||
|
||||
--echo #---------------- Index merge test 2 -------------------------------------------
|
||||
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
create table t1
|
||||
(
|
||||
key1 int not null,
|
||||
key2 int not null,
|
||||
|
||||
INDEX i1(key1),
|
||||
INDEX i2(key2)
|
||||
);
|
||||
|
||||
--disable_query_log
|
||||
let $1=200;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t1 values (200-$1, $1);
|
||||
dec $1;
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
# No primary key
|
||||
explain select * from t1 where key1 < 5 or key2 > 197;
|
||||
|
||||
select * from t1 where key1 < 5 or key2 > 197;
|
||||
|
||||
explain select * from t1 where key1 < 3 or key2 > 195;
|
||||
select * from t1 where key1 < 3 or key2 > 195;
|
||||
|
||||
# Primary key as case-sensitive string with \0s.
|
||||
# also make primary key be longer then max. index length of MyISAM.
|
||||
alter table t1 add str1 char (255) not null,
|
||||
add zeroval int not null default 0,
|
||||
add str2 char (255) not null,
|
||||
add str3 char (255) not null;
|
||||
|
||||
update t1 set str1='aaa', str2='bbb', str3=concat(key2, '-', key1 div 2, '_' ,if(key1 mod 2 = 0, 'a', 'A'));
|
||||
|
||||
alter table t1 add primary key (str1, zeroval, str2, str3);
|
||||
|
||||
explain select * from t1 where key1 < 5 or key2 > 197;
|
||||
|
||||
select * from t1 where key1 < 5 or key2 > 197;
|
||||
|
||||
explain select * from t1 where key1 < 3 or key2 > 195;
|
||||
select * from t1 where key1 < 3 or key2 > 195;
|
||||
|
||||
# Test for BUG#5401
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
pk integer not null auto_increment primary key,
|
||||
key1 integer,
|
||||
key2 integer not null,
|
||||
filler char (200),
|
||||
index (key1),
|
||||
index (key2)
|
||||
);
|
||||
show warnings;
|
||||
--disable_query_log
|
||||
let $1=30;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t1 (key1, key2, filler) values ($1/4, $1/8, 'filler-data');
|
||||
dec $1;
|
||||
}
|
||||
--enable_query_log
|
||||
explain select pk from t1 where key1 = 1 and key2 = 1;
|
||||
select pk from t1 where key2 = 1 and key1 = 1;
|
||||
select pk from t1 ignore index(key1,key2) where key2 = 1 and key1 = 1;
|
||||
|
||||
# More tests for BUG#5401.
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
pk int primary key auto_increment,
|
||||
key1a int,
|
||||
key2a int,
|
||||
key1b int,
|
||||
key2b int,
|
||||
dummy1 int,
|
||||
dummy2 int,
|
||||
dummy3 int,
|
||||
dummy4 int,
|
||||
key3a int,
|
||||
key3b int,
|
||||
filler1 char (200),
|
||||
index i1(key1a, key1b),
|
||||
index i2(key2a, key2b),
|
||||
index i3(key3a, key3b)
|
||||
);
|
||||
|
||||
create table t2 (a int);
|
||||
insert into t2 values (0),(1),(2),(3),(4),(NULL);
|
||||
|
||||
insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
|
||||
select A.a, B.a, C.a, D.a, C.a, D.a from t2 A,t2 B,t2 C, t2 D;
|
||||
insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
|
||||
select key1a, key1b, key2a, key2b, key3a, key3b from t1;
|
||||
insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
|
||||
select key1a, key1b, key2a, key2b, key3a, key3b from t1;
|
||||
analyze table t1;
|
||||
select count(*) from t1;
|
||||
|
||||
explain select count(*) from t1 where
|
||||
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
|
||||
|
||||
select count(*) from t1 where
|
||||
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
|
||||
|
||||
explain select count(*) from t1 where
|
||||
key1a = 2 and key1b is null and key3a = 2 and key3b is null;
|
||||
|
||||
select count(*) from t1 where
|
||||
key1a = 2 and key1b is null and key3a = 2 and key3b is null;
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
# Test for BUG#8441
|
||||
create table t1 (
|
||||
id1 int,
|
||||
id2 date ,
|
||||
index idx2 (id1,id2),
|
||||
index idx1 (id2)
|
||||
);
|
||||
insert into t1 values(1,'20040101'), (2,'20040102');
|
||||
select * from t1 where id1 = 1 and id2= '20040101';
|
||||
drop table t1;
|
||||
|
||||
# Test for BUG#12720
|
||||
--disable_warnings
|
||||
drop view if exists v1;
|
||||
--enable_warnings
|
||||
CREATE TABLE t1 (
|
||||
`oid` int(11) unsigned NOT NULL auto_increment,
|
||||
`fk_bbk_niederlassung` int(11) unsigned NOT NULL,
|
||||
`fk_wochentag` int(11) unsigned NOT NULL,
|
||||
`uhrzeit_von` time NOT NULL COMMENT 'HH:MM',
|
||||
`uhrzeit_bis` time NOT NULL COMMENT 'HH:MM',
|
||||
`geloescht` tinyint(4) NOT NULL,
|
||||
`version` int(5) NOT NULL,
|
||||
PRIMARY KEY (`oid`),
|
||||
KEY `fk_bbk_niederlassung` (`fk_bbk_niederlassung`),
|
||||
KEY `fk_wochentag` (`fk_wochentag`),
|
||||
KEY `ix_version` (`version`)
|
||||
) DEFAULT CHARSET=latin1;
|
||||
|
||||
insert into t1 values
|
||||
(1, 38, 1, '08:00:00', '13:00:00', 0, 1),
|
||||
(2, 38, 2, '08:00:00', '13:00:00', 0, 1),
|
||||
(3, 38, 3, '08:00:00', '13:00:00', 0, 1),
|
||||
(4, 38, 4, '08:00:00', '13:00:00', 0, 1),
|
||||
(5, 38, 5, '08:00:00', '13:00:00', 0, 1),
|
||||
(6, 38, 5, '08:00:00', '13:00:00', 1, 2),
|
||||
(7, 38, 3, '08:00:00', '13:00:00', 1, 2),
|
||||
(8, 38, 1, '08:00:00', '13:00:00', 1, 2),
|
||||
(9, 38, 2, '08:00:00', '13:00:00', 1, 2),
|
||||
(10, 38, 4, '08:00:00', '13:00:00', 1, 2),
|
||||
(11, 38, 1, '08:00:00', '13:00:00', 0, 3),
|
||||
(12, 38, 2, '08:00:00', '13:00:00', 0, 3),
|
||||
(13, 38, 3, '08:00:00', '13:00:00', 0, 3),
|
||||
(14, 38, 4, '08:00:00', '13:00:00', 0, 3),
|
||||
(15, 38, 5, '08:00:00', '13:00:00', 0, 3),
|
||||
(16, 38, 4, '08:00:00', '13:00:00', 0, 4),
|
||||
(17, 38, 5, '08:00:00', '13:00:00', 0, 4),
|
||||
(18, 38, 1, '08:00:00', '13:00:00', 0, 4),
|
||||
(19, 38, 2, '08:00:00', '13:00:00', 0, 4),
|
||||
(20, 38, 3, '08:00:00', '13:00:00', 0, 4),
|
||||
(21, 7, 1, '08:00:00', '13:00:00', 0, 1),
|
||||
(22, 7, 2, '08:00:00', '13:00:00', 0, 1),
|
||||
(23, 7, 3, '08:00:00', '13:00:00', 0, 1),
|
||||
(24, 7, 4, '08:00:00', '13:00:00', 0, 1),
|
||||
(25, 7, 5, '08:00:00', '13:00:00', 0, 1);
|
||||
|
||||
create view v1 as
|
||||
select
|
||||
zeit1.oid AS oid,
|
||||
zeit1.fk_bbk_niederlassung AS fk_bbk_niederlassung,
|
||||
zeit1.fk_wochentag AS fk_wochentag,
|
||||
zeit1.uhrzeit_von AS uhrzeit_von,
|
||||
zeit1.uhrzeit_bis AS uhrzeit_bis,
|
||||
zeit1.geloescht AS geloescht,
|
||||
zeit1.version AS version
|
||||
from
|
||||
t1 zeit1
|
||||
where
|
||||
(zeit1.version =
|
||||
(select max(zeit2.version) AS `max(version)`
|
||||
from t1 zeit2
|
||||
where
|
||||
((zeit1.fk_bbk_niederlassung = zeit2.fk_bbk_niederlassung) and
|
||||
(zeit1.fk_wochentag = zeit2.fk_wochentag) and
|
||||
(zeit1.uhrzeit_von = zeit2.uhrzeit_von) and
|
||||
(zeit1.uhrzeit_bis = zeit2.uhrzeit_bis)
|
||||
)
|
||||
)
|
||||
)
|
||||
and (zeit1.geloescht = 0);
|
||||
|
||||
select * from v1 where oid = 21;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
##
|
||||
CREATE TABLE t1(
|
||||
t_cpac varchar(2) NOT NULL,
|
||||
t_vers varchar(4) NOT NULL,
|
||||
t_rele varchar(2) NOT NULL,
|
||||
t_cust varchar(4) NOT NULL,
|
||||
filler1 char(250) default NULL,
|
||||
filler2 char(250) default NULL,
|
||||
PRIMARY KEY (t_cpac,t_vers,t_rele,t_cust),
|
||||
UNIQUE KEY IX_4 (t_cust,t_cpac,t_vers,t_rele),
|
||||
KEY IX_5 (t_vers,t_rele,t_cust)
|
||||
);
|
||||
|
||||
insert into t1 values
|
||||
('tm','2.5 ','a ',' ','',''), ('tm','2.5U','a ','stnd','',''),
|
||||
('da','3.3 ','b ',' ','',''), ('da','3.3U','b ','stnd','',''),
|
||||
('tl','7.6 ','a ',' ','',''), ('tt','7.6 ','a ',' ','',''),
|
||||
('bc','B61 ','a ',' ','',''), ('bp','B61 ','a ',' ','',''),
|
||||
('ca','B61 ','a ',' ','',''), ('ci','B61 ','a ',' ','',''),
|
||||
('cp','B61 ','a ',' ','',''), ('dm','B61 ','a ',' ','',''),
|
||||
('ec','B61 ','a ',' ','',''), ('ed','B61 ','a ',' ','',''),
|
||||
('fm','B61 ','a ',' ','',''), ('nt','B61 ','a ',' ','',''),
|
||||
('qm','B61 ','a ',' ','',''), ('tc','B61 ','a ',' ','',''),
|
||||
('td','B61 ','a ',' ','',''), ('tf','B61 ','a ',' ','',''),
|
||||
('tg','B61 ','a ',' ','',''), ('ti','B61 ','a ',' ','',''),
|
||||
('tp','B61 ','a ',' ','',''), ('ts','B61 ','a ',' ','',''),
|
||||
('wh','B61 ','a ',' ','',''), ('bc','B61U','a ','stnd','',''),
|
||||
('bp','B61U','a ','stnd','',''), ('ca','B61U','a ','stnd','',''),
|
||||
('ci','B61U','a ','stnd','',''), ('cp','B61U','a ','stnd','',''),
|
||||
('dm','B61U','a ','stnd','',''), ('ec','B61U','a ','stnd','',''),
|
||||
('fm','B61U','a ','stnd','',''), ('nt','B61U','a ','stnd','',''),
|
||||
('qm','B61U','a ','stnd','',''), ('tc','B61U','a ','stnd','',''),
|
||||
('td','B61U','a ','stnd','',''), ('tf','B61U','a ','stnd','',''),
|
||||
('tg','B61U','a ','stnd','',''), ('ti','B61U','a ','stnd','',''),
|
||||
('tp','B61U','a ','stnd','',''), ('ts','B61U','a ','stnd','',''),
|
||||
('wh','B61U','a ','stnd','','');
|
||||
show create table t1;
|
||||
|
||||
select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6';
|
||||
select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6'
|
||||
and t_rele='a' and t_cust = ' ';
|
||||
|
||||
drop table t1;
|
||||
|
||||
# BUG#19021: Crash in index_merge/ROR-intersection optimizer under
|
||||
# specific circumstances.
|
||||
create table t1 (
|
||||
pk int(11) not null auto_increment,
|
||||
a int(11) not null default '0',
|
||||
b int(11) not null default '0',
|
||||
c int(11) not null default '0',
|
||||
|
||||
filler1 datetime, filler2 varchar(15),
|
||||
filler3 longtext,
|
||||
|
||||
kp1 varchar(4), kp2 varchar(7),
|
||||
kp3 varchar(2), kp4 varchar(4),
|
||||
kp5 varchar(7),
|
||||
filler4 char(1),
|
||||
|
||||
primary key (pk),
|
||||
key idx1(a,b,c),
|
||||
key idx2(c),
|
||||
key idx3(kp1,kp2,kp3,kp4,kp5)
|
||||
) default charset=latin1;
|
||||
--disable_query_log
|
||||
set @fill= uncompress(unhex(concat(
|
||||
'F91D0000789CDD993D6FDB301086F7FE0A6D4E0105B8E3F1335D5BA028DA0EEDE28E1D320408',
|
||||
'52A0713BF4D7571FB62C51A475924839080307B603E77DEE787C8FA41F9E9EEF7F1F8A87A7C3',
|
||||
'AFE280C5DF9F8F7FEE9F8B1B2CB114D6902E918455245DB91300FA16E42D5201FA4EE29DA05D',
|
||||
'B9FB3718A33718A3FA8C30AEFAFDE1F317D016AA67BA7A60FDE45BF5F8BA7B5BDE8812AA9F1A',
|
||||
'069DB03C9804346644F3A3A6A1338DB572756A3C4D1BCC804CABF912C654AE9BB855A2B85962',
|
||||
'3A479259CAE6A86C0411D01AE5483581EDCBD9A39C45252D532E533979EB9F82E971D979BDB4',
|
||||
'8531105670740AFBFD1E34AAB0029E4AD0A1D46A6D0946A21A16038A5CD965CD2D524673F712',
|
||||
'20C304477315CE18405EAF9BD0AFFEAC74FDA14F1FBF5BD34C769D73FBBEDF4750ADD4E5A99C',
|
||||
'5C8DC04934AFA275D483D536D174C11B12AF27F8F888B41B6FC9DBA569E1FD7BD72D698130B7',
|
||||
'91B23A98803512B3D31881E8DCDA2AC1754E3644C4BB3A8466750B911681274A39E35E8624B7',
|
||||
'444A42AC1213F354758E3CF1A4CDD5A688C767CF1B11ABC5867CB15D8A18E0B91E9EC275BB94',
|
||||
'58F33C2936F64690D55BC29E4A293D95A798D84217736CEAAA538CE1354269EE2162053FBC66',
|
||||
'496D90CB53323CB279D3A6AF651B4B22B9E430743D83BE48E995A09D4FC9871C22D8D189B945',
|
||||
'706911BCB8C3C774B9C08D2FC6ED853ADACA37A14A4CB2E027630E5B80ECACD939431B1CDF62',
|
||||
'7D71487536EA2C678F59685E91F4B6C144BCCB94C1EBA9FA6F5552DDCA4E4539BE326A2720CB',
|
||||
'45ED028EB3616AC93C46E775FEA9FA6DA7CFCEC6DEBA5FCD1F915EED4D983BDDB881528AD9AB',
|
||||
'43C1576F29AAB35BDFBC21D422F52B307D350589D45225A887AC46C8EDD72D99EC3ED2E1BCEF',
|
||||
'7AF26FC4C74097B6768A5EDAFA660CC64278F7E63F99AC954B')));
|
||||
prepare x from @fill;
|
||||
execute x;
|
||||
deallocate prepare x;
|
||||
--enable_query_log
|
||||
set @fill=NULL;
|
||||
SELECT COUNT(*) FROM t1 WHERE b = 0 AND a = 0 AND c = 13286427 AND
|
||||
kp1='279' AND kp2='ELM0678' AND kp3='6' AND kp4='10' AND kp5 = 'R ';
|
||||
|
||||
drop table t1;
|
||||
|
||||
|
|
@ -1,7 +1,20 @@
|
|||
# include/index_merge_2sweeps.inc
|
||||
#
|
||||
# 2-sweeps read Index_merge test
|
||||
#
|
||||
-- source include/have_innodb.inc
|
||||
# The variable
|
||||
# $engine_type -- storage engine to be tested
|
||||
# has to be set before sourcing this script.
|
||||
#
|
||||
# Last update:
|
||||
# 2006-08-02 ML test refactored
|
||||
# old name was index_merge_innodb2.test
|
||||
# main code went into include/index_merge_2sweeps.inc
|
||||
#
|
||||
|
||||
--echo #---------------- 2-sweeps read Index merge test 2 -------------------------------
|
||||
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
|
@ -10,12 +23,12 @@ drop table if exists t1;
|
|||
create table t1 (
|
||||
pk int primary key,
|
||||
key1 int,
|
||||
key2 int,
|
||||
key2 int,
|
||||
filler char(200),
|
||||
filler2 char(200),
|
||||
filler2 char(200),
|
||||
index(key1),
|
||||
index(key2)
|
||||
) engine=innodb;
|
||||
);
|
||||
|
||||
|
||||
--disable_query_log
|
||||
|
@ -31,20 +44,20 @@ select * from t1 where (key1 >= 2 and key1 <= 10) or (pk >= 4 and pk <=8 );
|
|||
|
||||
set @maxv=1000;
|
||||
|
||||
select * from t1 where
|
||||
(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
|
||||
select * from t1 where
|
||||
(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
|
||||
or key1=18 or key1=60;
|
||||
|
||||
select * from t1 where
|
||||
(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
|
||||
select * from t1 where
|
||||
(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
|
||||
or key1 < 3 or key1 > @maxv-11;
|
||||
|
||||
select * from t1 where
|
||||
(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
|
||||
select * from t1 where
|
||||
(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
|
||||
or
|
||||
(key1 < 5) or (key1 > 10 and key1 < 15) or (key1 >= 50 and key1 < 55 ) or (key1 > @maxv-10);
|
||||
|
||||
select * from t1 where
|
||||
select * from t1 where
|
||||
(pk > 10 and pk < 15) or (pk >= 50 and pk < 55 )
|
||||
or
|
||||
(key1 < 5) or (key1 > @maxv-10);
|
|
@ -1,10 +1,27 @@
|
|||
# include/index_merge_ror.inc
|
||||
#
|
||||
# ROR-index_merge tests.
|
||||
# ROR-index_merge tests.
|
||||
#
|
||||
# The variable
|
||||
# $engine_type -- storage engine to be tested
|
||||
# has to be set before sourcing this script.
|
||||
#
|
||||
# Note: The comments/expectations refer to MyISAM.
|
||||
# They might be not valid for other storage engines.
|
||||
#
|
||||
# Last update:
|
||||
# 2006-08-02 ML test refactored
|
||||
# old name was t/index_merge_ror.test
|
||||
# main code went into include/index_merge_ror.inc
|
||||
#
|
||||
|
||||
--echo #---------------- ROR-index_merge tests -----------------------
|
||||
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t0,t1,t2;
|
||||
--enable_warnings
|
||||
--disable_query_log
|
||||
create table t1
|
||||
(
|
||||
/* Field names reflect value(rowid) distribution, st=STairs, swt= SaWTooth */
|
||||
|
@ -29,7 +46,7 @@ create table t1
|
|||
filler4 char (200),
|
||||
filler5 char (200),
|
||||
filler6 char (200),
|
||||
|
||||
|
||||
/* order of keys is important */
|
||||
key sta_swt12a(st_a,swt1a,swt2a),
|
||||
key sta_swt1a(st_a,swt1a),
|
||||
|
@ -47,21 +64,26 @@ create table t1
|
|||
key(key4)
|
||||
) ;
|
||||
|
||||
# Fill table
|
||||
# Fill table
|
||||
create table t0 as select * from t1;
|
||||
--disable_query_log
|
||||
--echo # Printing of many insert into t0 values (....) disabled.
|
||||
let $cnt=1000;
|
||||
while ($cnt)
|
||||
{
|
||||
eval insert into t0 values (1, 2, 3, 1, 2, 3, 0, 0, 0, 0, 'data1', 'data2', 'data3', 'data4', 'data5', 'data6');
|
||||
dec $cnt;
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
alter table t1 disable keys;
|
||||
--disable_query_log
|
||||
--echo # Printing of many insert into t1 select .... from t0 disabled.
|
||||
let $1=4;
|
||||
while ($1)
|
||||
{
|
||||
let $2=4;
|
||||
while ($2)
|
||||
while ($2)
|
||||
{
|
||||
let $3=4;
|
||||
while ($3)
|
||||
|
@ -74,6 +96,7 @@ while ($1)
|
|||
dec $1;
|
||||
}
|
||||
|
||||
--echo # Printing of many insert into t1 (...) values (....) disabled.
|
||||
# Row retrieval tests
|
||||
# -1 is used for values 'out of any range we are using'
|
||||
# insert enough rows for index intersection to be used for (key1,key2)
|
||||
|
@ -90,17 +113,17 @@ while ($cnt)
|
|||
eval insert into t1 (key1, key2, key3, key4, filler1) values (-1, 100, -1, 100,'key2-key4');
|
||||
dec $cnt;
|
||||
}
|
||||
alter table t1 enable keys;
|
||||
--enable_query_log
|
||||
alter table t1 enable keys;
|
||||
select count(*) from t1;
|
||||
|
||||
# One row results tests for cases where a single row matches all conditions
|
||||
# One row results tests for cases where a single row matches all conditions
|
||||
explain select key1,key2 from t1 where key1=100 and key2=100;
|
||||
select key1,key2 from t1 where key1=100 and key2=100;
|
||||
explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
|
||||
select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
|
||||
|
||||
# Several-rows results
|
||||
# Several-rows results
|
||||
insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, -1, -1, 'key1-key2');
|
||||
insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, 100, 100, 'key4-key3');
|
||||
|
||||
|
@ -150,7 +173,7 @@ explain select key1,key2 from t1 where key1=100 and key2=100;
|
|||
select key1,key2 from t1 where key1=100 and key2=100;
|
||||
|
||||
# ROR-union tests with various cases.
|
||||
# All scans returning duplicate rows:
|
||||
# All scans returning duplicate rows:
|
||||
insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-1');
|
||||
insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-2');
|
||||
insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-3');
|
||||
|
@ -169,7 +192,7 @@ explain select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 a
|
|||
select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
|
||||
|
||||
##
|
||||
## Optimizer tests
|
||||
## Optimizer tests
|
||||
##
|
||||
|
||||
# Check that the shortest key is used for ROR-intersection, covering and non-covering.
|
||||
|
@ -179,9 +202,9 @@ explain select st_a,st_b from t1 where st_a=1 and st_b=1;
|
|||
# Check if "ingore index" syntax works
|
||||
explain select st_a from t1 ignore index (st_a) where st_a=1 and st_b=1;
|
||||
|
||||
# Do many tests
|
||||
# Do many tests
|
||||
# Check that keys that don't improve selectivity are skipped.
|
||||
#
|
||||
#
|
||||
|
||||
# Different value on 32 and 64 bit
|
||||
--replace_result sta_swt12a sta_swt21a sta_swt12a, sta_swt12a,
|
||||
|
@ -191,25 +214,25 @@ explain select * from t1 where st_b=1 and swt1b=1 and swt2b=1;
|
|||
|
||||
explain select * from t1 where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
|
||||
|
||||
explain select * from t1 ignore index (sta_swt21a, stb_swt1a_2b)
|
||||
explain select * from t1 ignore index (sta_swt21a, stb_swt1a_2b)
|
||||
where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
|
||||
|
||||
explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b)
|
||||
explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b)
|
||||
where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
|
||||
|
||||
explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b, stb_swt1b)
|
||||
explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b, stb_swt1b)
|
||||
where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
|
||||
|
||||
explain select * from t1
|
||||
explain select * from t1
|
||||
where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1;
|
||||
|
||||
explain select * from t1
|
||||
explain select * from t1
|
||||
where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1;
|
||||
|
||||
explain select st_a from t1
|
||||
explain select st_a from t1
|
||||
where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1;
|
||||
|
||||
explain select st_a from t1
|
||||
explain select st_a from t1
|
||||
where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1;
|
||||
|
||||
drop table t0,t1;
|
||||
|
@ -240,7 +263,7 @@ insert into t2 select * from t2;
|
|||
select count(a) from t2 where a='BBBBBBBB';
|
||||
select count(a) from t2 where b='BBBBBBBB';
|
||||
|
||||
# BUG#1:
|
||||
# BUG#1:
|
||||
--replace_result a a_or_b b a_or_b
|
||||
explain select count(a) from t2 where a='AAAAAAAA' and b='AAAAAAAA';
|
||||
select count(a) from t2 where a='AAAAAAAA' and b='AAAAAAAA';
|
|
@ -1,7 +1,23 @@
|
|||
# include/index_merge_ror_cpk.inc
|
||||
#
|
||||
# Clustered PK ROR-index_merge tests
|
||||
#
|
||||
-- source include/have_innodb.inc
|
||||
# The variable
|
||||
# $engine_type -- storage engine to be tested
|
||||
# has to be set before sourcing this script.
|
||||
#
|
||||
# Note: The comments/expectations refer to InnoDB.
|
||||
# They might be not valid for other storage engines.
|
||||
#
|
||||
# Last update:
|
||||
# 2006-08-02 ML test refactored
|
||||
# old name was t/index_merge_ror_cpk.test
|
||||
# main code went into include/index_merge_ror_cpk.inc
|
||||
#
|
||||
|
||||
--echo #---------------- Clustered PK ROR-index_merge tests -----------------------------
|
||||
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
|
@ -9,14 +25,14 @@ drop table if exists t1;
|
|||
|
||||
create table t1
|
||||
(
|
||||
pk1 int not null,
|
||||
pk1 int not null,
|
||||
pk2 int not null,
|
||||
|
||||
|
||||
key1 int not null,
|
||||
key2 int not null,
|
||||
|
||||
pktail1ok int not null,
|
||||
pktail2ok int not null,
|
||||
pktail1ok int not null,
|
||||
pktail2ok int not null,
|
||||
pktail3bad int not null,
|
||||
pktail4bad int not null,
|
||||
pktail5bad int not null,
|
||||
|
@ -37,7 +53,7 @@ create table t1
|
|||
key (pktail5bad, pk1, pk2, pk2copy),
|
||||
|
||||
primary key (pk1, pk2)
|
||||
) engine=innodb;
|
||||
);
|
||||
|
||||
--disable_query_log
|
||||
set autocommit=0;
|
||||
|
@ -50,13 +66,13 @@ while ($1)
|
|||
set autocommit=1;
|
||||
--enable_query_log
|
||||
|
||||
# Verify that range scan on CPK is ROR
|
||||
# (use index_intersection because it is impossible to check that for index union)
|
||||
# Verify that range scan on CPK is ROR
|
||||
# (use index_intersection because it is impossible to check that for index union)
|
||||
explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
|
||||
# CPK scan + 1 ROR range scan is a special case
|
||||
select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
|
||||
|
||||
# Verify that CPK fields are considered to be covered by index scans
|
||||
# Verify that CPK fields are considered to be covered by index scans
|
||||
explain select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1;
|
||||
select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1;
|
||||
|
||||
|
@ -65,12 +81,13 @@ select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1;
|
|||
explain select * from t1 where badkey=1 and key1=10;
|
||||
--replace_column 9 ROWS
|
||||
explain select * from t1 where pk1 < 7500 and key1 = 10;
|
||||
|
||||
|
||||
# Verify that keys with 'tails' of PK members are ok.
|
||||
explain select * from t1 where pktail1ok=1 and key1=10;
|
||||
explain select * from t1 where pktail2ok=1 and key1=10;
|
||||
|
||||
select ' The following is actually a deficiency, it uses sort_union currently:' as 'note:';
|
||||
# Note: The following is actually a deficiency, it uses sort_union currently.
|
||||
# This comment refers to InnoDB and is probably not valid for other engines.
|
||||
explain select * from t1 where (pktail2ok=1 and pk1< 50000) or key1=10;
|
||||
|
||||
# The expected rows differs a bit from platform to platform
|
||||
|
@ -79,33 +96,33 @@ explain select * from t1 where pktail3bad=1 and key1=10;
|
|||
explain select * from t1 where pktail4bad=1 and key1=10;
|
||||
explain select * from t1 where pktail5bad=1 and key1=10;
|
||||
|
||||
# Test for problem with innodb key values prefetch buffer:
|
||||
# Test for problem with innodb key values prefetch buffer:
|
||||
explain select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10;
|
||||
select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10;
|
||||
|
||||
drop table t1;
|
||||
# Testcase for BUG#4984
|
||||
create table t1
|
||||
(
|
||||
RUNID varchar(22),
|
||||
SUBMITNR varchar(5),
|
||||
ORDERNR char(1) ,
|
||||
PROGRAMM varchar(8),
|
||||
TESTID varchar(4),
|
||||
UCCHECK char(1),
|
||||
ETEXT varchar(80),
|
||||
(
|
||||
RUNID varchar(22),
|
||||
SUBMITNR varchar(5),
|
||||
ORDERNR char(1),
|
||||
PROGRAMM varchar(8),
|
||||
TESTID varchar(4),
|
||||
UCCHECK char(1),
|
||||
ETEXT varchar(80),
|
||||
ETEXT_TYPE char(1),
|
||||
INFO char(1),
|
||||
SEVERITY tinyint(3),
|
||||
TADIRFLAG char(1),
|
||||
PRIMARY KEY (RUNID,SUBMITNR,ORDERNR,PROGRAMM,TESTID,UCCHECK),
|
||||
INFO char(1),
|
||||
SEVERITY tinyint(3),
|
||||
TADIRFLAG char(1),
|
||||
PRIMARY KEY (RUNID,SUBMITNR,ORDERNR,PROGRAMM,TESTID,UCCHECK),
|
||||
KEY `TVERM~KEY` (PROGRAMM,TESTID,UCCHECK)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
update t1 set `ETEXT` = '', `ETEXT_TYPE`='', `INFO`='', `SEVERITY`='', `TADIRFLAG`=''
|
||||
WHERE
|
||||
`RUNID`= '' AND `SUBMITNR`= '' AND `ORDERNR`='' AND `PROGRAMM`='' AND
|
||||
`TESTID`='' AND `UCCHECK`='';
|
||||
) DEFAULT CHARSET=latin1;
|
||||
|
||||
update t1 set `ETEXT` = '', `ETEXT_TYPE`='', `INFO`='', `SEVERITY`='', `TADIRFLAG`=''
|
||||
WHERE
|
||||
`RUNID`= '' AND `SUBMITNR`= '' AND `ORDERNR`='' AND `PROGRAMM`='' AND
|
||||
`TESTID`='' AND `UCCHECK`='';
|
||||
|
||||
drop table t1;
|
||||
|
323
mysql-test/include/mix1.inc
Normal file
323
mysql-test/include/mix1.inc
Normal file
|
@ -0,0 +1,323 @@
|
|||
# include/mix1.inc
|
||||
#
|
||||
# The variables
|
||||
# $engine_type -- storage engine to be tested
|
||||
# $other_engine_type -- storage engine <> $engine_type
|
||||
# $other_engine_type should be an alltime
|
||||
# available storage engine like MyISAM or MEMORY
|
||||
# have to be set before sourcing this script.
|
||||
#
|
||||
# Note: The comments/expectations refer to InnoDB.
|
||||
# They might be not valid for other storage engines.
|
||||
#
|
||||
# Last update:
|
||||
# 2006-08-15 ML refactoring of t/innodb_mysql.test
|
||||
# - shift main code of t/innodb_mysql.test to include/mix1.inc
|
||||
# - replace hardcoded assignment of storage engine by
|
||||
# use of $engine_type and $other_engine_type variables
|
||||
# - remove redundant replay testcase of
|
||||
# Bug#12882 min/max inconsistent on empty table
|
||||
# - corrected analyze table t1; to analyze table t4;
|
||||
# Much older versions of this test show that the table
|
||||
# where just some indexes have been created must be used.
|
||||
#
|
||||
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t1m,t1i,t2m,t2i,t4;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Bug#17530: Incorrect key truncation on table creation caused server crash.
|
||||
#
|
||||
create table t1(f1 varchar(800) binary not null, key(f1))
|
||||
character set utf8 collate utf8_general_ci;
|
||||
insert into t1 values('aaa');
|
||||
drop table t1;
|
||||
|
||||
# BUG#16798: Uninitialized row buffer reads in ref-or-null optimizer
|
||||
# (repeatable only w/innodb).
|
||||
create table t1 (
|
||||
c_id int(11) not null default '0',
|
||||
org_id int(11) default null,
|
||||
unique key contacts$c_id (c_id),
|
||||
key contacts$org_id (org_id)
|
||||
);
|
||||
insert into t1 values
|
||||
(2,null),(120,null),(141,null),(218,7), (128,1),
|
||||
(151,2),(234,2),(236,2),(243,2),(255,2),(259,2),(232,3),(235,3),(238,3),
|
||||
(246,3),(253,3),(269,3),(285,3),(291,3),(293,3),(131,4),(230,4),(231,4);
|
||||
|
||||
create table t2 (
|
||||
slai_id int(11) not null default '0',
|
||||
owner_tbl int(11) default null,
|
||||
owner_id int(11) default null,
|
||||
sla_id int(11) default null,
|
||||
inc_web int(11) default null,
|
||||
inc_email int(11) default null,
|
||||
inc_chat int(11) default null,
|
||||
inc_csr int(11) default null,
|
||||
inc_total int(11) default null,
|
||||
time_billed int(11) default null,
|
||||
activedate timestamp null default null,
|
||||
expiredate timestamp null default null,
|
||||
state int(11) default null,
|
||||
sla_set int(11) default null,
|
||||
unique key t2$slai_id (slai_id),
|
||||
key t2$owner_id (owner_id),
|
||||
key t2$sla_id (sla_id)
|
||||
);
|
||||
insert into t2(slai_id, owner_tbl, owner_id, sla_id) values
|
||||
(1,3,1,1), (3,3,10,2), (4,3,3,6), (5,3,2,5), (6,3,8,3), (7,3,9,7),
|
||||
(8,3,6,8), (9,3,4,9), (10,3,5,10), (11,3,11,11), (12,3,7,12);
|
||||
|
||||
flush tables;
|
||||
select si.slai_id
|
||||
from t1 c join t2 si on
|
||||
((si.owner_tbl = 3 and si.owner_id = c.org_id) or
|
||||
( si.owner_tbl = 2 and si.owner_id = c.c_id))
|
||||
where
|
||||
c.c_id = 218 and expiredate is null;
|
||||
|
||||
select * from t1 where org_id is null;
|
||||
select si.slai_id
|
||||
from t1 c join t2 si on
|
||||
((si.owner_tbl = 3 and si.owner_id = c.org_id) or
|
||||
( si.owner_tbl = 2 and si.owner_id = c.c_id))
|
||||
where
|
||||
c.c_id = 218 and expiredate is null;
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Bug#17212: results not sorted correctly by ORDER BY when using index
|
||||
# (repeatable only w/innodb because of index props)
|
||||
#
|
||||
CREATE TABLE t1 (a int, b int, KEY b (b)) Engine=InnoDB;
|
||||
CREATE TABLE t2 (a int, b int, PRIMARY KEY (a,b)) Engine=InnoDB;
|
||||
CREATE TABLE t3 (a int, b int, c int, PRIMARY KEY (a),
|
||||
UNIQUE KEY b (b,c), KEY a (a,b,c)) Engine=InnoDB;
|
||||
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 SELECT a + 1, b + 1 FROM t1;
|
||||
INSERT INTO t1 SELECT a + 2, b + 2 FROM t1;
|
||||
|
||||
INSERT INTO t2 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8);
|
||||
INSERT INTO t2 SELECT a + 1, b FROM t2;
|
||||
DELETE FROM t2 WHERE a = 1 AND b < 2;
|
||||
|
||||
INSERT INTO t3 VALUES (1,1,1),(2,1,2);
|
||||
INSERT INTO t3 SELECT a + 2, a + 2, 3 FROM t3;
|
||||
INSERT INTO t3 SELECT a + 4, a + 4, 3 FROM t3;
|
||||
|
||||
# demonstrate a problem when a must-use-sort table flag
|
||||
# (sort_by_table=1) is being neglected.
|
||||
SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
|
||||
t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
|
||||
ORDER BY t1.b LIMIT 2;
|
||||
|
||||
# demonstrate the problem described in the bug report
|
||||
SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
|
||||
t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
|
||||
ORDER BY t1.b LIMIT 5;
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
||||
#
|
||||
# Bug #12882 min/max inconsistent on empty table
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
eval create table t1m (a int) engine = $other_engine_type;
|
||||
create table t1i (a int);
|
||||
eval create table t2m (a int) engine = $other_engine_type;
|
||||
create table t2i (a int);
|
||||
--enable_warnings
|
||||
insert into t2m values (5);
|
||||
insert into t2i values (5);
|
||||
|
||||
# test with $engine_type
|
||||
select min(a) from t1i;
|
||||
select min(7) from t1i;
|
||||
select min(7) from DUAL;
|
||||
explain select min(7) from t2i join t1i;
|
||||
select min(7) from t2i join t1i;
|
||||
|
||||
select max(a) from t1i;
|
||||
select max(7) from t1i;
|
||||
select max(7) from DUAL;
|
||||
explain select max(7) from t2i join t1i;
|
||||
select max(7) from t2i join t1i;
|
||||
|
||||
select 1, min(a) from t1i where a=99;
|
||||
select 1, min(a) from t1i where 1=99;
|
||||
select 1, min(1) from t1i where a=99;
|
||||
select 1, min(1) from t1i where 1=99;
|
||||
|
||||
select 1, max(a) from t1i where a=99;
|
||||
select 1, max(a) from t1i where 1=99;
|
||||
select 1, max(1) from t1i where a=99;
|
||||
select 1, max(1) from t1i where 1=99;
|
||||
|
||||
# mixed $engine_type/$other_engine_type test
|
||||
explain select count(*), min(7), max(7) from t1m, t1i;
|
||||
select count(*), min(7), max(7) from t1m, t1i;
|
||||
|
||||
explain select count(*), min(7), max(7) from t1m, t2i;
|
||||
select count(*), min(7), max(7) from t1m, t2i;
|
||||
|
||||
explain select count(*), min(7), max(7) from t2m, t1i;
|
||||
select count(*), min(7), max(7) from t2m, t1i;
|
||||
|
||||
drop table t1m, t1i, t2m, t2i;
|
||||
|
||||
#
|
||||
# Bug #12882: primary key implcitly included in every innodb index
|
||||
# (was part of group_min_max.test)
|
||||
#
|
||||
|
||||
eval create table t1 (
|
||||
a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
|
||||
) ENGINE = $other_engine_type;
|
||||
|
||||
insert into t1 (a1, a2, b, c, d) values
|
||||
('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
|
||||
('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
|
||||
('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
|
||||
('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
|
||||
('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
|
||||
('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
|
||||
('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
|
||||
('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
|
||||
('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
|
||||
('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
|
||||
('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
|
||||
('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
|
||||
('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
|
||||
('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
|
||||
('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
|
||||
('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'),
|
||||
('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
|
||||
('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
|
||||
('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
|
||||
('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
|
||||
('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
|
||||
('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
|
||||
('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
|
||||
('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
|
||||
('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
|
||||
('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
|
||||
('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
|
||||
('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
|
||||
('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
|
||||
('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
|
||||
('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
|
||||
('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
|
||||
--disable_warnings
|
||||
create table t4 (
|
||||
pk_col int auto_increment primary key, a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
|
||||
);
|
||||
--enable_warnings
|
||||
insert into t4 (a1, a2, b, c, d, dummy) select * from t1;
|
||||
|
||||
create index idx12672_0 on t4 (a1);
|
||||
create index idx12672_1 on t4 (a1,a2,b,c);
|
||||
create index idx12672_2 on t4 (a1,a2,b);
|
||||
analyze table t4;
|
||||
|
||||
select distinct a1 from t4 where pk_col not in (1,2,3,4);
|
||||
|
||||
drop table t1,t4;
|
||||
|
||||
#
|
||||
# Bug #6142: a problem with the empty innodb table
|
||||
# (was part of group_min_max.test)
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
create table t1 (
|
||||
a varchar(30), b varchar(30), primary key(a), key(b)
|
||||
);
|
||||
--enable_warnings
|
||||
select distinct a from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #9798: group by with rollup
|
||||
# (was part of group_min_max.test)
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
create table t1(a int, key(a));
|
||||
--enable_warnings
|
||||
insert into t1 values(1);
|
||||
select a, count(a) from t1 group by a with rollup;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #13293 Wrongly used index results in endless loop.
|
||||
# (was part of group_min_max.test)
|
||||
#
|
||||
create table t1 (f1 int, f2 char(1), primary key(f1,f2));
|
||||
insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d");
|
||||
alter table t1 drop primary key, add primary key (f2, f1);
|
||||
explain select distinct f1 a, f1 b from t1;
|
||||
explain select distinct f1, f2 from t1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Test of behaviour with CREATE ... SELECT
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
insert into t1 values (1,1),(1,2);
|
||||
--error 1062
|
||||
CREATE TABLE t2 (primary key (a)) select * from t1;
|
||||
# This should give warning
|
||||
drop table if exists t2;
|
||||
--error 1062
|
||||
CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1;
|
||||
# This should give warning
|
||||
drop table if exists t2;
|
||||
CREATE TABLE t2 (a int, b int, primary key (a));
|
||||
BEGIN;
|
||||
INSERT INTO t2 values(100,100);
|
||||
--error 1062
|
||||
CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
|
||||
SELECT * from t2;
|
||||
ROLLBACK;
|
||||
SELECT * from t2;
|
||||
TRUNCATE table t2;
|
||||
--error 1062
|
||||
INSERT INTO t2 select * from t1;
|
||||
SELECT * from t2;
|
||||
drop table t2;
|
||||
|
||||
CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a));
|
||||
BEGIN;
|
||||
INSERT INTO t2 values(100,100);
|
||||
--error 1062
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
|
||||
SELECT * from t2;
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO t2 values(101,101);
|
||||
--error 1062
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
|
||||
SELECT * from t2;
|
||||
ROLLBACK;
|
||||
SELECT * from t2;
|
||||
TRUNCATE table t2;
|
||||
--error 1062
|
||||
INSERT INTO t2 select * from t1;
|
||||
SELECT * from t2;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Bug#17530: Incorrect key truncation on table creation caused server crash.
|
||||
#
|
||||
create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
|
||||
character set utf8 collate utf8_general_ci;
|
||||
insert into t1 values('aaa');
|
||||
drop table t1;
|
2689
mysql-test/include/mix2.inc
Normal file
2689
mysql-test/include/mix2.inc
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,18 @@
|
|||
-- source include/have_innodb.inc
|
||||
-- source include/have_query_cache.inc
|
||||
# include/query_cache.inc
|
||||
#
|
||||
# The variables
|
||||
# $engine_type -- storage engine to be tested
|
||||
# $test_foreign_keys -- 0, skip foreign key tests
|
||||
# -- 1, do not skip foreign key tests
|
||||
# have to be set before sourcing this script.
|
||||
#
|
||||
# Last update:
|
||||
# 2006-08-02 ML test refactored
|
||||
# old name was innodb_cache.test
|
||||
# main code went into include/query_cache.inc
|
||||
#
|
||||
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
|
||||
# Initialise
|
||||
--disable_warnings
|
||||
|
@ -11,7 +24,7 @@ drop table if exists t1,t2,t3;
|
|||
#
|
||||
flush status;
|
||||
set autocommit=0;
|
||||
create table t1 (a int not null) engine=innodb;
|
||||
create table t1 (a int not null);
|
||||
insert into t1 values (1),(2),(3);
|
||||
select * from t1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
|
@ -19,15 +32,15 @@ drop table t1;
|
|||
commit;
|
||||
set autocommit=1;
|
||||
begin;
|
||||
create table t1 (a int not null) engine=innodb;
|
||||
create table t1 (a int not null);
|
||||
insert into t1 values (1),(2),(3);
|
||||
select * from t1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
drop table t1;
|
||||
commit;
|
||||
create table t1 (a int not null) engine=innodb;
|
||||
create table t2 (a int not null) engine=innodb;
|
||||
create table t3 (a int not null) engine=innodb;
|
||||
create table t1 (a int not null);
|
||||
create table t2 (a int not null);
|
||||
create table t3 (a int not null);
|
||||
insert into t1 values (1),(2);
|
||||
insert into t2 values (1),(2);
|
||||
insert into t3 values (1),(2);
|
||||
|
@ -54,20 +67,22 @@ commit;
|
|||
show status like "Qcache_queries_in_cache";
|
||||
drop table t3,t2,t1;
|
||||
|
||||
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=InnoDB;
|
||||
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id));
|
||||
select count(*) from t1;
|
||||
insert into t1 (id) values (0);
|
||||
select count(*) from t1;
|
||||
drop table t1;
|
||||
|
||||
if ($test_foreign_keys)
|
||||
{
|
||||
#
|
||||
# one statement roll back inside transation
|
||||
#
|
||||
let $save_query_cache_size=`select @@global.query_cache_size`;
|
||||
set GLOBAL query_cache_size=1355776;
|
||||
CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a)) ENGINE=innodb;
|
||||
CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b)) ENGINE=innodb;
|
||||
CREATE TABLE t3 ( id int(10) NOT NULL auto_increment, t1_id int(10) NOT NULL default '0', t2_id int(10) NOT NULL default '0', state int(11) default NULL, PRIMARY KEY (id), UNIQUE KEY t1_id (t1_id,t2_id), KEY t2_id (t2_id,t1_id), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`), CONSTRAINT `t3_ibfk_2` FOREIGN KEY (`t2_id`) REFERENCES `t2` (`id`)) ENGINE=innodb;
|
||||
CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a));
|
||||
CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b));
|
||||
CREATE TABLE t3 ( id int(10) NOT NULL auto_increment, t1_id int(10) NOT NULL default '0', t2_id int(10) NOT NULL default '0', state int(11) default NULL, PRIMARY KEY (id), UNIQUE KEY t1_id (t1_id,t2_id), KEY t2_id (t2_id,t1_id), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`), CONSTRAINT `t3_ibfk_2` FOREIGN KEY (`t2_id`) REFERENCES `t2` (`id`));
|
||||
INSERT INTO t1 VALUES (1,'me');
|
||||
INSERT INTO t2 VALUES (1,'you');
|
||||
INSERT INTO t3 VALUES (2,1,1,2);
|
||||
|
@ -83,5 +98,6 @@ drop table t3,t2,t1;
|
|||
--disable_query_log
|
||||
eval set GLOBAL query_cache_size=$save_query_cache_size;
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
# End of 4.1 tests
|
|
@ -1,21 +1,27 @@
|
|||
# include/read_many_rows.inc
|
||||
#
|
||||
# Test how filesort and buffered-record-reads works
|
||||
# This test needs a lot of time.
|
||||
#
|
||||
# The variable
|
||||
# $engine_type -- storage engine to be tested
|
||||
# has to be set before sourcing this script.
|
||||
#
|
||||
# Last update:
|
||||
# 2006-08-03 ML test refactored (MySQL 5.1)
|
||||
# main code t/innodb-big.test --> include/read_many_rows.inc
|
||||
#
|
||||
# Test some things that takes a long time
|
||||
|
||||
-- source include/big_test.inc
|
||||
-- source include/have_innodb.inc
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2, t3, t4;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Test test how filesort and buffered-record-reads works with innodb
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (id INTEGER) ENGINE=MYISAM;
|
||||
CREATE TABLE t2 (id INTEGER primary key) ENGINE=INNODB;
|
||||
CREATE TABLE t3 (a char(32) primary key,id INTEGER) ENGINE=INNODB;
|
||||
CREATE TABLE t4 (a char(32) primary key,id INTEGER) ENGINE=MYISAM;
|
||||
CREATE TABLE t2 (id INTEGER PRIMARY KEY);
|
||||
CREATE TABLE t3 (a CHAR(32) PRIMARY KEY,id INTEGER);
|
||||
CREATE TABLE t4 (a CHAR(32) PRIMARY KEY,id INTEGER) ENGINE=MYISAM;
|
||||
|
||||
INSERT INTO t1 (id) VALUES (1);
|
||||
INSERT INTO t1 SELECT id+1 FROM t1;
|
||||
|
@ -39,8 +45,10 @@ INSERT INTO t1 SELECT id+131072 FROM t1;
|
|||
INSERT INTO t1 SELECT id+262144 FROM t1;
|
||||
INSERT INTO t1 SELECT id+524288 FROM t1;
|
||||
INSERT INTO t1 SELECT id+1048576 FROM t1;
|
||||
|
||||
INSERT INTO t2 SELECT * FROM t1;
|
||||
INSERT INTO t3 SELECT concat(id),id from t2 ORDER BY -id;
|
||||
INSERT INTO t4 SELECT * from t3 ORDER BY concat(a);
|
||||
select sum(id) from t3;
|
||||
drop table t1,t2,t3,t4;
|
||||
INSERT INTO t3 SELECT CONCAT(id),id FROM t2 ORDER BY -id;
|
||||
INSERT INTO t4 SELECT * FROM t3 ORDER BY CONCAT(a);
|
||||
SELECT SUM(id) FROM t3;
|
||||
|
||||
DROP TABLE t1,t2,t3,t4;
|
121
mysql-test/include/rowid_order.inc
Normal file
121
mysql-test/include/rowid_order.inc
Normal file
|
@ -0,0 +1,121 @@
|
|||
# include/rowid_order.inc
|
||||
#
|
||||
# Test for rowid ordering (and comparison) functions.
|
||||
# do index_merge select for tables with PK of various types.
|
||||
#
|
||||
# The variable
|
||||
# $engine_type -- storage engine to be tested
|
||||
# has to be set before sourcing this script.
|
||||
#
|
||||
# Note: The comments/expections refer to InnoDB.
|
||||
# They might be not valid for other storage engines.
|
||||
#
|
||||
# Last update:
|
||||
# 2006-08-02 ML test refactored
|
||||
# old name was t/rowid_order.test
|
||||
# main code went into include/rowid_order.inc
|
||||
#
|
||||
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2, t3,t4;
|
||||
--enable_warnings
|
||||
|
||||
# Signed number as rowid
|
||||
create table t1 (
|
||||
pk1 int not NULL,
|
||||
key1 int(11),
|
||||
key2 int(11),
|
||||
PRIMARY KEY (pk1),
|
||||
KEY key1 (key1),
|
||||
KEY key2 (key2)
|
||||
);
|
||||
insert into t1 values (-5, 1, 1),
|
||||
(-100, 1, 1),
|
||||
(3, 1, 1),
|
||||
(0, 1, 1),
|
||||
(10, 1, 1);
|
||||
explain select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
|
||||
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
|
||||
drop table t1;
|
||||
|
||||
# Unsigned numbers as rowids
|
||||
create table t1 (
|
||||
pk1 int unsigned not NULL,
|
||||
key1 int(11),
|
||||
key2 int(11),
|
||||
PRIMARY KEY (pk1),
|
||||
KEY key1 (key1),
|
||||
KEY key2 (key2)
|
||||
);
|
||||
insert into t1 values (0, 1, 1),
|
||||
(0xFFFFFFFF, 1, 1),
|
||||
(0xFFFFFFFE, 1, 1),
|
||||
(1, 1, 1),
|
||||
(2, 1, 1);
|
||||
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
|
||||
drop table t1;
|
||||
|
||||
# Case-insensitive char(N)
|
||||
create table t1 (
|
||||
pk1 char(4) not NULL,
|
||||
key1 int(11),
|
||||
key2 int(11),
|
||||
PRIMARY KEY (pk1),
|
||||
KEY key1 (key1),
|
||||
KEY key2 (key2)
|
||||
) collate latin2_general_ci;
|
||||
insert into t1 values ('a1', 1, 1),
|
||||
('b2', 1, 1),
|
||||
('A3', 1, 1),
|
||||
('B4', 1, 1);
|
||||
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
|
||||
drop table t1;
|
||||
|
||||
# Multi-part PK
|
||||
create table t1 (
|
||||
pk1 int not NULL,
|
||||
pk2 char(4) not NULL collate latin1_german1_ci,
|
||||
pk3 char(4) not NULL collate latin1_bin,
|
||||
key1 int(11),
|
||||
key2 int(11),
|
||||
PRIMARY KEY (pk1,pk2,pk3),
|
||||
KEY key1 (key1),
|
||||
KEY key2 (key2)
|
||||
);
|
||||
insert into t1 values
|
||||
(1, 'u', 'u', 1, 1),
|
||||
(1, 'u', char(0xEC), 1, 1),
|
||||
(1, 'u', 'x', 1, 1);
|
||||
insert ignore into t1 select pk1, char(0xEC), pk3, key1, key2 from t1;
|
||||
insert ignore into t1 select pk1, 'x', pk3, key1, key2 from t1 where pk2='u';
|
||||
insert ignore into t1 select 2, pk2, pk3, key1, key2 from t1;
|
||||
select * from t1;
|
||||
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
|
||||
|
||||
# Hidden PK
|
||||
alter table t1 drop primary key;
|
||||
select * from t1;
|
||||
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
|
||||
drop table t1;
|
||||
|
||||
# Variable-length PK
|
||||
# this is also test for Bug#2688
|
||||
create table t1 (
|
||||
pk1 varchar(8) NOT NULL default '',
|
||||
pk2 varchar(4) NOT NULL default '',
|
||||
key1 int(11),
|
||||
key2 int(11),
|
||||
primary key(pk1, pk2),
|
||||
KEY key1 (key1),
|
||||
KEY key2 (key2)
|
||||
);
|
||||
insert into t1 values ('','empt',2,2),
|
||||
('a','a--a',2,2),
|
||||
('bb','b--b',2,2),
|
||||
('ccc','c--c',2,2),
|
||||
('dddd','d--d',2,2);
|
||||
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
|
||||
|
||||
drop table t1;
|
|
@ -1,20 +1,34 @@
|
|||
-- source include/have_innodb.inc
|
||||
# include/unsafe_binlog.inc
|
||||
#
|
||||
# Note that these tests uses options
|
||||
# The variable
|
||||
# $engine_type -- storage engine to be tested
|
||||
# has to be set before sourcing this script.
|
||||
#
|
||||
# Notes:
|
||||
# 1. This test uses at least in case of InnoDB options
|
||||
# innodb_locks_unsafe_for_binlog = true
|
||||
# innodb_lock_timeout = 5
|
||||
# 2. The comments/expectations refer to InnoDB.
|
||||
# They might be not valid for other storage engines.
|
||||
#
|
||||
# Last update:
|
||||
# 2006-08-02 ML test refactored
|
||||
# old name was innodb_unsafe_binlog.test
|
||||
# main code went into include/unsafe_binlog.inc
|
||||
#
|
||||
|
||||
#
|
||||
# Test cases for a bug #15650
|
||||
# Test cases for bug#15650
|
||||
# DELETE with LEFT JOIN crashes server with innodb_locks_unsafe_for_binlog
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
create table t1 (id int not null, f_id int not null, f int not null,
|
||||
primary key(f_id, id)) engine=innodb;
|
||||
create table t2 (id int not null,s_id int not null,s varchar(200),
|
||||
primary key(id)) engine=innodb;
|
||||
eval create table t1 (id int not null, f_id int not null, f int not null,
|
||||
primary key(f_id, id)) engine = $engine_type;
|
||||
eval create table t2 (id int not null,s_id int not null,s varchar(200),
|
||||
primary key(id)) engine = $engine_type;
|
||||
INSERT INTO t1 VALUES (8, 1, 3);
|
||||
INSERT INTO t1 VALUES (1, 2, 1);
|
||||
INSERT INTO t2 VALUES (1, 0, '');
|
||||
|
@ -34,10 +48,10 @@ drop table t1,t2;
|
|||
connect (a,localhost,root,,);
|
||||
connect (b,localhost,root,,);
|
||||
connection a;
|
||||
create table t1(a int not null, b int, primary key(a)) engine=innodb;
|
||||
eval create table t1(a int not null, b int, primary key(a)) engine = $engine_type;
|
||||
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
|
||||
commit;
|
||||
set autocommit = 0;
|
||||
set autocommit = 0;
|
||||
select * from t1 lock in share mode;
|
||||
update t1 set b = 5 where b = 1;
|
||||
connection b;
|
||||
|
@ -63,10 +77,10 @@ disconnect b;
|
|||
connect (a,localhost,root,,);
|
||||
connect (b,localhost,root,,);
|
||||
connection a;
|
||||
create table t1(a int not null, b int, primary key(a)) engine=innodb;
|
||||
eval create table t1(a int not null, b int, primary key(a)) engine = $engine_type;
|
||||
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
|
||||
commit;
|
||||
set autocommit = 0;
|
||||
set autocommit = 0;
|
||||
update t1 set b = 5 where b = 1;
|
||||
connection b;
|
||||
set autocommit = 0;
|
||||
|
@ -93,9 +107,9 @@ disconnect b;
|
|||
connect (a,localhost,root,,);
|
||||
connect (b,localhost,root,,);
|
||||
connection a;
|
||||
create table t1(a int not null, b int, primary key(a)) engine=innodb;
|
||||
eval create table t1(a int not null, b int, primary key(a)) engine = $engine_type;
|
||||
insert into t1 values (1,2),(5,3),(4,2);
|
||||
create table t2(d int not null, e int, primary key(d)) engine=innodb;
|
||||
eval create table t2(d int not null, e int, primary key(d)) engine = $engine_type;
|
||||
insert into t2 values (8,6),(12,1),(3,1);
|
||||
commit;
|
||||
set autocommit = 0;
|
||||
|
@ -104,7 +118,7 @@ connection b;
|
|||
set autocommit = 0;
|
||||
insert into t1 select * from t2;
|
||||
update t1 set b = (select e from t2 where a = d);
|
||||
create table t3(d int not null, e int, primary key(d)) engine=innodb
|
||||
eval create table t3(d int not null, e int, primary key(d)) engine = $engine_type
|
||||
select * from t2;
|
||||
commit;
|
||||
connection a;
|
||||
|
@ -115,7 +129,7 @@ disconnect b;
|
|||
drop table t1, t2, t3;
|
||||
|
||||
#
|
||||
# Consistent read should not be used if
|
||||
# Consistent read should not be used if
|
||||
#
|
||||
# (a) isolation level is serializable OR
|
||||
# (b) select ... lock in share mode OR
|
||||
|
@ -131,26 +145,29 @@ connect (a,localhost,root,,);
|
|||
connect (b,localhost,root,,);
|
||||
connect (c,localhost,root,,);
|
||||
connect (d,localhost,root,,);
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
connect (e,localhost,root,,);
|
||||
connect (f,localhost,root,,);
|
||||
connect (g,localhost,root,,);
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
connect (h,localhost,root,,);
|
||||
connect (i,localhost,root,,);
|
||||
connect (j,localhost,root,,);
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
connection a;
|
||||
create table t1(a int not null, b int, primary key(a)) engine=innodb;
|
||||
eval create table t1(a int not null, b int, primary key(a)) engine = $engine_type;
|
||||
insert into t1 values (1,2),(5,3),(4,2);
|
||||
create table t2(a int not null, b int, primary key(a)) engine=innodb;
|
||||
eval create table t2(a int not null, b int, primary key(a)) engine = $engine_type;
|
||||
insert into t2 values (8,6),(12,1),(3,1);
|
||||
create table t3(d int not null, b int, primary key(d)) engine=innodb;
|
||||
eval create table t3(d int not null, b int, primary key(d)) engine = $engine_type;
|
||||
insert into t3 values (8,6),(12,1),(3,1);
|
||||
create table t5(a int not null, b int, primary key(a)) engine=innodb;
|
||||
eval create table t5(a int not null, b int, primary key(a)) engine = $engine_type;
|
||||
insert into t5 values (1,2),(5,3),(4,2);
|
||||
create table t6(d int not null, e int, primary key(d)) engine=innodb;
|
||||
eval create table t6(d int not null, e int, primary key(d)) engine = $engine_type;
|
||||
insert into t6 values (8,6),(12,1),(3,1);
|
||||
create table t8(a int not null, b int, primary key(a)) engine=innodb;
|
||||
eval create table t8(a int not null, b int, primary key(a)) engine = $engine_type;
|
||||
insert into t8 values (1,2),(5,3),(4,2);
|
||||
create table t9(d int not null, e int, primary key(d)) engine=innodb;
|
||||
eval create table t9(d int not null, e int, primary key(d)) engine = $engine_type;
|
||||
insert into t9 values (8,6),(12,1),(3,1);
|
||||
commit;
|
||||
set autocommit = 0;
|
||||
|
@ -169,7 +186,7 @@ connection d;
|
|||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
--send
|
||||
create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2;
|
||||
create table t4(a int not null, b int, primary key(a)) select * from t2;
|
||||
connection e;
|
||||
set autocommit = 0;
|
||||
--send
|
||||
|
@ -181,7 +198,7 @@ update t6 set e = (select b from t2 where a = d lock in share mode);
|
|||
connection g;
|
||||
set autocommit = 0;
|
||||
--send
|
||||
create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode;
|
||||
create table t7(a int not null, b int, primary key(a)) select * from t2 lock in share mode;
|
||||
connection h;
|
||||
set autocommit = 0;
|
||||
--send
|
||||
|
@ -193,7 +210,7 @@ update t9 set e = (select b from t2 where a = d for update);
|
|||
connection j;
|
||||
set autocommit = 0;
|
||||
--send
|
||||
create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update;
|
||||
create table t10(a int not null, b int, primary key(a)) select * from t2 for update;
|
||||
|
||||
connection b;
|
||||
--error 1205
|
|
@ -1,7 +1,8 @@
|
|||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
drop table if exists t1,t2,t3;
|
||||
flush status;
|
||||
set autocommit=0;
|
||||
create table t1 (a int not null) engine=innodb;
|
||||
create table t1 (a int not null);
|
||||
insert into t1 values (1),(2),(3);
|
||||
select * from t1;
|
||||
a
|
||||
|
@ -15,7 +16,7 @@ drop table t1;
|
|||
commit;
|
||||
set autocommit=1;
|
||||
begin;
|
||||
create table t1 (a int not null) engine=innodb;
|
||||
create table t1 (a int not null);
|
||||
insert into t1 values (1),(2),(3);
|
||||
select * from t1;
|
||||
a
|
||||
|
@ -27,9 +28,9 @@ Variable_name Value
|
|||
Qcache_queries_in_cache 1
|
||||
drop table t1;
|
||||
commit;
|
||||
create table t1 (a int not null) engine=innodb;
|
||||
create table t2 (a int not null) engine=innodb;
|
||||
create table t3 (a int not null) engine=innodb;
|
||||
create table t1 (a int not null);
|
||||
create table t2 (a int not null);
|
||||
create table t3 (a int not null);
|
||||
insert into t1 values (1),(2);
|
||||
insert into t2 values (1),(2);
|
||||
insert into t3 values (1),(2);
|
||||
|
@ -99,7 +100,7 @@ show status like "Qcache_queries_in_cache";
|
|||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
drop table t3,t2,t1;
|
||||
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=InnoDB;
|
||||
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id));
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
|
@ -109,9 +110,9 @@ count(*)
|
|||
1
|
||||
drop table t1;
|
||||
set GLOBAL query_cache_size=1355776;
|
||||
CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a)) ENGINE=innodb;
|
||||
CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b)) ENGINE=innodb;
|
||||
CREATE TABLE t3 ( id int(10) NOT NULL auto_increment, t1_id int(10) NOT NULL default '0', t2_id int(10) NOT NULL default '0', state int(11) default NULL, PRIMARY KEY (id), UNIQUE KEY t1_id (t1_id,t2_id), KEY t2_id (t2_id,t1_id), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`), CONSTRAINT `t3_ibfk_2` FOREIGN KEY (`t2_id`) REFERENCES `t2` (`id`)) ENGINE=innodb;
|
||||
CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a));
|
||||
CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b));
|
||||
CREATE TABLE t3 ( id int(10) NOT NULL auto_increment, t1_id int(10) NOT NULL default '0', t2_id int(10) NOT NULL default '0', state int(11) default NULL, PRIMARY KEY (id), UNIQUE KEY t1_id (t1_id,t2_id), KEY t2_id (t2_id,t1_id), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`), CONSTRAINT `t3_ibfk_2` FOREIGN KEY (`t2_id`) REFERENCES `t2` (`id`));
|
||||
INSERT INTO t1 VALUES (1,'me');
|
||||
INSERT INTO t2 VALUES (1,'you');
|
||||
INSERT INTO t3 VALUES (2,1,1,2);
|
|
@ -1,9 +1,7 @@
|
|||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
drop table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) ENGINE=innodb;
|
||||
Warnings:
|
||||
Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
|
@ -106,9 +104,7 @@ eta tipo c
|
|||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
drop table t1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) ENGINE=innodb;
|
||||
Warnings:
|
||||
Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
|
@ -211,7 +207,7 @@ eta tipo c
|
|||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
drop table t1;
|
||||
create table t1 (a int not null, b int not null) engine=innodb;
|
||||
create table t1 (a int not null, b int not null);
|
||||
insert into t1 values (1,1),(2,1),(3,1),(4,1);
|
||||
select get_lock("hello2",1000);
|
||||
get_lock("hello2",1000)
|
||||
|
@ -239,9 +235,7 @@ a b
|
|||
1 1
|
||||
commit;
|
||||
drop table t1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) ENGINE=innodb;
|
||||
Warnings:
|
||||
Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
|
@ -323,9 +317,7 @@ eta tipo c
|
|||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
drop table t1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) ENGINE=innodb;
|
||||
Warnings:
|
||||
Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
|
@ -407,9 +399,7 @@ eta tipo c
|
|||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
drop table t1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) ENGINE=innodb;
|
||||
Warnings:
|
||||
Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
|
@ -478,9 +468,7 @@ eta tipo c
|
|||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
drop table t1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) ENGINE=innodb;
|
||||
Warnings:
|
||||
Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
|
@ -549,9 +537,7 @@ eta tipo c
|
|||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
drop table t1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255)) ENGINE=innodb;
|
||||
Warnings:
|
||||
Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
|
@ -1,25 +1,33 @@
|
|||
# Establish connection con1 (user=root)
|
||||
# Establish connection con2 (user=root)
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (id integer, x integer) engine=INNODB;
|
||||
# Switch to connection con1
|
||||
create table t1 (id integer, x integer) engine = InnoDB;
|
||||
insert into t1 values(0, 0);
|
||||
set autocommit=0;
|
||||
SELECT * from t1 where id = 0 FOR UPDATE;
|
||||
id x
|
||||
0 0
|
||||
# Switch to connection con2
|
||||
set autocommit=0;
|
||||
update t1 set x=2 where id = 0;
|
||||
# Switch to connection con1
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
id x
|
||||
0 1
|
||||
commit;
|
||||
# Switch to connection con2
|
||||
commit;
|
||||
# Switch to connection con1
|
||||
select * from t1;
|
||||
id x
|
||||
0 2
|
||||
commit;
|
||||
drop table t1;
|
||||
create table t1 (id integer, x integer) engine=INNODB;
|
||||
create table t2 (b integer, a integer) engine=INNODB;
|
||||
# Switch to connection con1
|
||||
create table t1 (id integer, x integer) engine = InnoDB;
|
||||
create table t2 (b integer, a integer) engine = InnoDB;
|
||||
insert into t1 values(0, 0), (300, 300);
|
||||
insert into t2 values(0, 10), (1, 20), (2, 30);
|
||||
commit;
|
||||
|
@ -39,26 +47,31 @@ select * from t1;
|
|||
id x
|
||||
0 0
|
||||
300 300
|
||||
# Switch to connection con2
|
||||
set autocommit=0;
|
||||
update t1 set x=2 where id = 0;
|
||||
# Switch to connection con1
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
id x
|
||||
0 1
|
||||
300 300
|
||||
commit;
|
||||
# Switch to connection con2
|
||||
commit;
|
||||
# Switch to connection con1
|
||||
select * from t1;
|
||||
id x
|
||||
0 2
|
||||
300 300
|
||||
commit;
|
||||
drop table t1, t2;
|
||||
create table t1 (id integer, x integer) engine=INNODB;
|
||||
create table t2 (b integer, a integer) engine=INNODB;
|
||||
create table t1 (id integer, x integer) engine = InnoDB;
|
||||
create table t2 (b integer, a integer) engine = InnoDB;
|
||||
insert into t1 values(0, 0), (300, 300);
|
||||
insert into t2 values(0, 0), (1, 20), (2, 30);
|
||||
commit;
|
||||
# Switch to connection con1
|
||||
select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE;
|
||||
a b
|
||||
0 0
|
||||
|
@ -74,6 +87,7 @@ select * from t1;
|
|||
id x
|
||||
0 0
|
||||
300 300
|
||||
# Switch to connection con2
|
||||
update t2 set a=2 where b = 0;
|
||||
select * from t2;
|
||||
b a
|
||||
|
@ -81,16 +95,20 @@ b a
|
|||
1 20
|
||||
2 30
|
||||
update t1 set x=2 where id = 0;
|
||||
# Switch to connection con1
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
id x
|
||||
0 1
|
||||
300 300
|
||||
commit;
|
||||
# Switch to connection con2
|
||||
commit;
|
||||
# Switch to connection con1
|
||||
select * from t1;
|
||||
id x
|
||||
0 2
|
||||
300 300
|
||||
commit;
|
||||
# Switch to connection default + disconnect con1 and con2
|
||||
drop table t1, t2;
|
|
@ -1,3 +1,4 @@
|
|||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
drop table if exists t1,t3,t4,t5;
|
||||
create table t1 (a int, b char(10), key a(a), key b(a,b));
|
||||
insert into t1 values
|
||||
|
@ -137,6 +138,29 @@ a b
|
|||
handler t2 read last;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
|
||||
handler t2 close;
|
||||
handler t1 open;
|
||||
handler t1 read a next;
|
||||
a b
|
||||
14 aaa
|
||||
handler t1 read a next;
|
||||
a b
|
||||
15 bbb
|
||||
handler t1 close;
|
||||
handler t1 open;
|
||||
handler t1 read a prev;
|
||||
a b
|
||||
22 iii
|
||||
handler t1 read a prev;
|
||||
a b
|
||||
21 hhh
|
||||
handler t1 close;
|
||||
handler t1 open as t2;
|
||||
handler t2 read first;
|
||||
a b
|
||||
17 ddd
|
||||
alter table t1 engine = InnoDB;
|
||||
handler t2 read first;
|
||||
ERROR 42S02: Unknown table 't2' in HANDLER
|
||||
handler t1 open as t2;
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
|
@ -214,16 +238,16 @@ insert into t1 values ('');
|
|||
handler t1 open;
|
||||
handler t1 read first limit 9;
|
||||
table_id
|
||||
test_test.t1
|
||||
|
||||
test_test.t1
|
||||
create table t2(table_id char(20) primary key);
|
||||
insert into t2 values ('test_test.t2');
|
||||
insert into t2 values ('');
|
||||
handler t2 open;
|
||||
handler t2 read first limit 9;
|
||||
table_id
|
||||
test_test.t2
|
||||
|
||||
test_test.t2
|
||||
use test;
|
||||
drop table if exists t1;
|
||||
create table t1(table_id char(20) primary key);
|
||||
|
@ -238,14 +262,14 @@ handler test_test.t1 read first limit 9;
|
|||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1
|
||||
handler t1 read first limit 9;
|
||||
table_id
|
||||
test_test.t1
|
||||
|
||||
test_test.t1
|
||||
handler test_test.t2 read first limit 9;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1
|
||||
handler t2 read first limit 9;
|
||||
table_id
|
||||
test_test.t2
|
||||
|
||||
test_test.t2
|
||||
handler test_test.t1 close;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1
|
||||
handler t1 close;
|
||||
|
@ -463,6 +487,15 @@ Table Op Msg_type Msg_text
|
|||
test.t1 optimize status OK
|
||||
proceed with the normal connection
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2));
|
||||
INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2);
|
||||
HANDLER t1 OPEN;
|
||||
HANDLER t1 READ `primary` = (1, 1000);
|
||||
no1 no2
|
||||
HANDLER t1 READ `primary` PREV;
|
||||
no1 no2
|
||||
1 275
|
||||
DROP TABLE t1;
|
||||
create table t1 (c1 int);
|
||||
insert into t1 values (14397);
|
||||
flush tables with read lock;
|
517
mysql-test/r/handler_myisam.result
Normal file
517
mysql-test/r/handler_myisam.result
Normal file
|
@ -0,0 +1,517 @@
|
|||
SET SESSION STORAGE_ENGINE = MyISAM;
|
||||
drop table if exists t1,t3,t4,t5;
|
||||
create table t1 (a int, b char(10), key a(a), key b(a,b));
|
||||
insert into t1 values
|
||||
(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
|
||||
(14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"),
|
||||
(20,"ggg"),(21,"hhh"),(22,"iii");
|
||||
handler t1 open as t2;
|
||||
handler t2 read a=(SELECT 1);
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT 1)' at line 1
|
||||
handler t2 read a first;
|
||||
a b
|
||||
14 aaa
|
||||
handler t2 read a next;
|
||||
a b
|
||||
15 bbb
|
||||
handler t2 read a next;
|
||||
a b
|
||||
16 ccc
|
||||
handler t2 read a prev;
|
||||
a b
|
||||
15 bbb
|
||||
handler t2 read a last;
|
||||
a b
|
||||
22 iii
|
||||
handler t2 read a prev;
|
||||
a b
|
||||
21 hhh
|
||||
handler t2 read a prev;
|
||||
a b
|
||||
20 ggg
|
||||
handler t2 read a first;
|
||||
a b
|
||||
14 aaa
|
||||
handler t2 read a prev;
|
||||
a b
|
||||
handler t2 read a last;
|
||||
a b
|
||||
22 iii
|
||||
handler t2 read a prev;
|
||||
a b
|
||||
21 hhh
|
||||
handler t2 read a next;
|
||||
a b
|
||||
22 iii
|
||||
handler t2 read a next;
|
||||
a b
|
||||
handler t2 read a=(15);
|
||||
a b
|
||||
15 bbb
|
||||
handler t2 read a=(16);
|
||||
a b
|
||||
16 ccc
|
||||
handler t2 read a=(19,"fff");
|
||||
ERROR 42000: Too many key parts specified; max 1 parts allowed
|
||||
handler t2 read b=(19,"fff");
|
||||
a b
|
||||
19 fff
|
||||
handler t2 read b=(19,"yyy");
|
||||
a b
|
||||
19 yyy
|
||||
handler t2 read b=(19);
|
||||
a b
|
||||
19 fff
|
||||
handler t1 read a last;
|
||||
ERROR 42S02: Unknown table 't1' in HANDLER
|
||||
handler t2 read a=(11);
|
||||
a b
|
||||
handler t2 read a>=(11);
|
||||
a b
|
||||
14 aaa
|
||||
handler t2 read a=(18);
|
||||
a b
|
||||
18 eee
|
||||
handler t2 read a>=(18);
|
||||
a b
|
||||
18 eee
|
||||
handler t2 read a>(18);
|
||||
a b
|
||||
19 fff
|
||||
handler t2 read a<=(18);
|
||||
a b
|
||||
18 eee
|
||||
handler t2 read a<(18);
|
||||
a b
|
||||
17 ddd
|
||||
handler t2 read a first limit 5;
|
||||
a b
|
||||
14 aaa
|
||||
15 bbb
|
||||
16 ccc
|
||||
16 xxx
|
||||
17 ddd
|
||||
handler t2 read a next limit 3;
|
||||
a b
|
||||
18 eee
|
||||
19 fff
|
||||
19 yyy
|
||||
handler t2 read a prev limit 10;
|
||||
a b
|
||||
19 fff
|
||||
18 eee
|
||||
17 ddd
|
||||
16 xxx
|
||||
16 ccc
|
||||
15 bbb
|
||||
14 aaa
|
||||
handler t2 read a>=(16) limit 4;
|
||||
a b
|
||||
16 ccc
|
||||
16 xxx
|
||||
17 ddd
|
||||
18 eee
|
||||
handler t2 read a>=(16) limit 2,2;
|
||||
a b
|
||||
17 ddd
|
||||
18 eee
|
||||
handler t2 read a last limit 3;
|
||||
a b
|
||||
22 iii
|
||||
21 hhh
|
||||
20 ggg
|
||||
handler t2 read a=(19);
|
||||
a b
|
||||
19 fff
|
||||
handler t2 read a=(19) where b="yyy";
|
||||
a b
|
||||
19 yyy
|
||||
handler t2 read first;
|
||||
a b
|
||||
17 ddd
|
||||
handler t2 read next;
|
||||
a b
|
||||
18 eee
|
||||
handler t2 read next;
|
||||
a b
|
||||
19 fff
|
||||
handler t2 read last;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
|
||||
handler t2 close;
|
||||
handler t1 open;
|
||||
handler t1 read a next;
|
||||
a b
|
||||
14 aaa
|
||||
handler t1 read a next;
|
||||
a b
|
||||
15 bbb
|
||||
handler t1 close;
|
||||
handler t1 open;
|
||||
handler t1 read a prev;
|
||||
a b
|
||||
22 iii
|
||||
handler t1 read a prev;
|
||||
a b
|
||||
21 hhh
|
||||
handler t1 close;
|
||||
handler t1 open as t2;
|
||||
handler t2 read first;
|
||||
a b
|
||||
17 ddd
|
||||
alter table t1 engine = MyISAM;
|
||||
handler t2 read first;
|
||||
ERROR 42S02: Unknown table 't2' in HANDLER
|
||||
handler t1 open as t2;
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (17);
|
||||
handler t2 read first;
|
||||
ERROR 42S02: Unknown table 't2' in HANDLER
|
||||
handler t1 open as t2;
|
||||
alter table t1 engine=MyISAM;
|
||||
handler t2 read first;
|
||||
ERROR 42S02: Unknown table 't2' in HANDLER
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6);
|
||||
delete from t1 limit 2;
|
||||
handler t1 open;
|
||||
handler t1 read first;
|
||||
a
|
||||
3
|
||||
handler t1 read first limit 1,1;
|
||||
a
|
||||
4
|
||||
handler t1 read first limit 2,2;
|
||||
a
|
||||
5
|
||||
6
|
||||
delete from t1 limit 3;
|
||||
handler t1 read first;
|
||||
a
|
||||
6
|
||||
drop table t1;
|
||||
create table t1(a int, index(a));
|
||||
insert into t1 values (1), (2), (3);
|
||||
handler t1 open;
|
||||
handler t1 read a=(W);
|
||||
ERROR 42S22: Unknown column 'W' in 'field list'
|
||||
handler t1 read a=(a);
|
||||
ERROR HY000: Incorrect arguments to HANDLER ... READ
|
||||
drop table t1;
|
||||
create table t1 (a char(5));
|
||||
insert into t1 values ("Ok");
|
||||
handler t1 open as t;
|
||||
handler t read first;
|
||||
a
|
||||
Ok
|
||||
use mysql;
|
||||
handler t read first;
|
||||
a
|
||||
Ok
|
||||
handler t close;
|
||||
handler test.t1 open as t;
|
||||
handler t read first;
|
||||
a
|
||||
Ok
|
||||
handler t close;
|
||||
use test;
|
||||
drop table t1;
|
||||
create table t1 ( a int, b int, INDEX a (a) );
|
||||
insert into t1 values (1,2), (2,1);
|
||||
handler t1 open;
|
||||
handler t1 read a=(1) where b=2;
|
||||
a b
|
||||
1 2
|
||||
handler t1 read a=(1) where b=3;
|
||||
a b
|
||||
handler t1 read a=(1) where b=1;
|
||||
a b
|
||||
handler t1 close;
|
||||
drop table t1;
|
||||
drop database if exists test_test;
|
||||
create database test_test;
|
||||
use test_test;
|
||||
create table t1(table_id char(20) primary key);
|
||||
insert into t1 values ('test_test.t1');
|
||||
insert into t1 values ('');
|
||||
handler t1 open;
|
||||
handler t1 read first limit 9;
|
||||
table_id
|
||||
test_test.t1
|
||||
|
||||
create table t2(table_id char(20) primary key);
|
||||
insert into t2 values ('test_test.t2');
|
||||
insert into t2 values ('');
|
||||
handler t2 open;
|
||||
handler t2 read first limit 9;
|
||||
table_id
|
||||
test_test.t2
|
||||
|
||||
use test;
|
||||
drop table if exists t1;
|
||||
create table t1(table_id char(20) primary key);
|
||||
insert into t1 values ('test.t1');
|
||||
insert into t1 values ('');
|
||||
handler t1 open;
|
||||
ERROR 42000: Not unique table/alias: 't1'
|
||||
use test;
|
||||
handler test.t1 read first limit 9;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1
|
||||
handler test_test.t1 read first limit 9;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1
|
||||
handler t1 read first limit 9;
|
||||
table_id
|
||||
test_test.t1
|
||||
|
||||
handler test_test.t2 read first limit 9;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1
|
||||
handler t2 read first limit 9;
|
||||
table_id
|
||||
test_test.t2
|
||||
|
||||
handler test_test.t1 close;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1
|
||||
handler t1 close;
|
||||
drop table test_test.t1;
|
||||
handler test_test.t2 close;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1
|
||||
handler t2 close;
|
||||
drop table test_test.t2;
|
||||
drop database test_test;
|
||||
use test;
|
||||
handler test.t1 close;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1
|
||||
handler t1 close;
|
||||
ERROR 42S02: Unknown table 't1' in HANDLER
|
||||
drop table test.t1;
|
||||
drop database if exists test_test;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop table if exists t3;
|
||||
create database test_test;
|
||||
use test_test;
|
||||
create table t1 (c1 char(20));
|
||||
insert into t1 values ('test_test.t1');
|
||||
create table t3 (c1 char(20));
|
||||
insert into t3 values ('test_test.t3');
|
||||
handler t1 open;
|
||||
handler t1 read first limit 9;
|
||||
c1
|
||||
test_test.t1
|
||||
handler t1 open h1;
|
||||
handler h1 read first limit 9;
|
||||
c1
|
||||
test_test.t1
|
||||
use test;
|
||||
create table t1 (c1 char(20));
|
||||
create table t2 (c1 char(20));
|
||||
create table t3 (c1 char(20));
|
||||
insert into t1 values ('t1');
|
||||
insert into t2 values ('t2');
|
||||
insert into t3 values ('t3');
|
||||
handler t1 open;
|
||||
ERROR 42000: Not unique table/alias: 't1'
|
||||
handler t2 open t1;
|
||||
ERROR 42000: Not unique table/alias: 't1'
|
||||
handler t3 open t1;
|
||||
ERROR 42000: Not unique table/alias: 't1'
|
||||
handler t1 read first limit 9;
|
||||
c1
|
||||
test_test.t1
|
||||
handler test.t1 close;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1
|
||||
handler test.t1 open h1;
|
||||
ERROR 42000: Not unique table/alias: 'h1'
|
||||
handler test_test.t1 open h1;
|
||||
ERROR 42000: Not unique table/alias: 'h1'
|
||||
handler test_test.t3 open h3;
|
||||
handler test.t1 open h2;
|
||||
handler t1 read first limit 9;
|
||||
c1
|
||||
test_test.t1
|
||||
handler h1 read first limit 9;
|
||||
c1
|
||||
test_test.t1
|
||||
handler h2 read first limit 9;
|
||||
c1
|
||||
t1
|
||||
handler h3 read first limit 9;
|
||||
c1
|
||||
test_test.t3
|
||||
handler h2 read first limit 9;
|
||||
c1
|
||||
t1
|
||||
handler test.h1 close;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'close' at line 1
|
||||
handler t1 close;
|
||||
handler h1 close;
|
||||
handler h2 close;
|
||||
handler t1 read first limit 9;
|
||||
ERROR 42S02: Unknown table 't1' in HANDLER
|
||||
handler h1 read first limit 9;
|
||||
ERROR 42S02: Unknown table 'h1' in HANDLER
|
||||
handler h2 read first limit 9;
|
||||
ERROR 42S02: Unknown table 'h2' in HANDLER
|
||||
handler h3 read first limit 9;
|
||||
c1
|
||||
test_test.t3
|
||||
handler h3 read first limit 9;
|
||||
c1
|
||||
test_test.t3
|
||||
use test_test;
|
||||
handler h3 read first limit 9;
|
||||
c1
|
||||
test_test.t3
|
||||
handler test.h3 read first limit 9;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read first limit 9' at line 1
|
||||
handler h3 close;
|
||||
use test;
|
||||
drop table t3;
|
||||
drop table t2;
|
||||
drop table t1;
|
||||
drop database test_test;
|
||||
create table t1 (c1 char(20));
|
||||
insert into t1 values ("t1");
|
||||
handler t1 open as h1;
|
||||
handler h1 read first limit 9;
|
||||
c1
|
||||
t1
|
||||
create table t2 (c1 char(20));
|
||||
insert into t2 values ("t2");
|
||||
handler t2 open as h2;
|
||||
handler h2 read first limit 9;
|
||||
c1
|
||||
t2
|
||||
create table t3 (c1 char(20));
|
||||
insert into t3 values ("t3");
|
||||
handler t3 open as h3;
|
||||
handler h3 read first limit 9;
|
||||
c1
|
||||
t3
|
||||
create table t4 (c1 char(20));
|
||||
insert into t4 values ("t4");
|
||||
handler t4 open as h4;
|
||||
handler h4 read first limit 9;
|
||||
c1
|
||||
t4
|
||||
create table t5 (c1 char(20));
|
||||
insert into t5 values ("t5");
|
||||
handler t5 open as h5;
|
||||
handler h5 read first limit 9;
|
||||
c1
|
||||
t5
|
||||
alter table t1 engine=MyISAM;
|
||||
handler h1 read first limit 9;
|
||||
ERROR 42S02: Unknown table 'h1' in HANDLER
|
||||
handler h2 read first limit 9;
|
||||
c1
|
||||
t2
|
||||
handler h3 read first limit 9;
|
||||
c1
|
||||
t3
|
||||
handler h4 read first limit 9;
|
||||
c1
|
||||
t4
|
||||
handler h5 read first limit 9;
|
||||
c1
|
||||
t5
|
||||
alter table t5 engine=MyISAM;
|
||||
handler h1 read first limit 9;
|
||||
ERROR 42S02: Unknown table 'h1' in HANDLER
|
||||
handler h2 read first limit 9;
|
||||
c1
|
||||
t2
|
||||
handler h3 read first limit 9;
|
||||
c1
|
||||
t3
|
||||
handler h4 read first limit 9;
|
||||
c1
|
||||
t4
|
||||
handler h5 read first limit 9;
|
||||
ERROR 42S02: Unknown table 'h5' in HANDLER
|
||||
alter table t3 engine=MyISAM;
|
||||
handler h1 read first limit 9;
|
||||
ERROR 42S02: Unknown table 'h1' in HANDLER
|
||||
handler h2 read first limit 9;
|
||||
c1
|
||||
t2
|
||||
handler h3 read first limit 9;
|
||||
ERROR 42S02: Unknown table 'h3' in HANDLER
|
||||
handler h4 read first limit 9;
|
||||
c1
|
||||
t4
|
||||
handler h5 read first limit 9;
|
||||
ERROR 42S02: Unknown table 'h5' in HANDLER
|
||||
handler h2 close;
|
||||
handler h4 close;
|
||||
handler t1 open as h1_1;
|
||||
handler t1 open as h1_2;
|
||||
handler t1 open as h1_3;
|
||||
handler h1_1 read first limit 9;
|
||||
c1
|
||||
t1
|
||||
handler h1_2 read first limit 9;
|
||||
c1
|
||||
t1
|
||||
handler h1_3 read first limit 9;
|
||||
c1
|
||||
t1
|
||||
alter table t1 engine=MyISAM;
|
||||
handler h1_1 read first limit 9;
|
||||
ERROR 42S02: Unknown table 'h1_1' in HANDLER
|
||||
handler h1_2 read first limit 9;
|
||||
ERROR 42S02: Unknown table 'h1_2' in HANDLER
|
||||
handler h1_3 read first limit 9;
|
||||
ERROR 42S02: Unknown table 'h1_3' in HANDLER
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop table t4;
|
||||
drop table t5;
|
||||
create table t1 (c1 int);
|
||||
insert into t1 values (1);
|
||||
handler t1 open;
|
||||
handler t1 read first;
|
||||
c1
|
||||
1
|
||||
send the below to another connection, do not wait for the result
|
||||
optimize table t1;
|
||||
proceed with the normal connection
|
||||
handler t1 read next;
|
||||
c1
|
||||
1
|
||||
handler t1 close;
|
||||
read the result from the other connection
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize status OK
|
||||
proceed with the normal connection
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2));
|
||||
INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2);
|
||||
HANDLER t1 OPEN;
|
||||
HANDLER t1 READ `primary` = (1, 1000);
|
||||
no1 no2
|
||||
HANDLER t1 READ `primary` PREV;
|
||||
no1 no2
|
||||
1 275
|
||||
DROP TABLE t1;
|
||||
create table t1 (c1 int);
|
||||
insert into t1 values (14397);
|
||||
flush tables with read lock;
|
||||
drop table t1;
|
||||
ERROR HY000: Can't execute the query because you have a conflicting read lock
|
||||
send the below to another connection, do not wait for the result
|
||||
drop table t1;
|
||||
proceed with the normal connection
|
||||
select * from t1;
|
||||
c1
|
||||
14397
|
||||
unlock tables;
|
||||
read the result from the other connection
|
||||
proceed with the normal connection
|
||||
select * from t1;
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
drop table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
|
@ -1,426 +0,0 @@
|
|||
drop table if exists t0, t1, t2, t3, t4;
|
||||
create table t0
|
||||
(
|
||||
key1 int not null,
|
||||
INDEX i1(key1)
|
||||
);
|
||||
alter table t0 add key2 int not null, add index i2(key2);
|
||||
alter table t0 add key3 int not null, add index i3(key3);
|
||||
alter table t0 add key4 int not null, add index i4(key4);
|
||||
alter table t0 add key5 int not null, add index i5(key5);
|
||||
alter table t0 add key6 int not null, add index i6(key6);
|
||||
alter table t0 add key7 int not null, add index i7(key7);
|
||||
alter table t0 add key8 int not null, add index i8(key8);
|
||||
update t0 set key2=key1,key3=key1,key4=key1,key5=key1,key6=key1,key7=key1,key8=1024-key1;
|
||||
analyze table t0;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t0 analyze status OK
|
||||
explain select * from t0 where key1 < 3 or key1 > 1020;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 range i1 i1 4 NULL 78 Using where
|
||||
explain
|
||||
select * from t0 where key1 < 3 or key2 > 1020;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 45 Using sort_union(i1,i2); Using where
|
||||
select * from t0 where key1 < 3 or key2 > 1020;
|
||||
key1 key2 key3 key4 key5 key6 key7 key8
|
||||
1 1 1 1 1 1 1 1023
|
||||
2 2 2 2 2 2 2 1022
|
||||
1021 1021 1021 1021 1021 1021 1021 3
|
||||
1022 1022 1022 1022 1022 1022 1022 2
|
||||
1023 1023 1023 1023 1023 1023 1023 1
|
||||
1024 1024 1024 1024 1024 1024 1024 0
|
||||
explain select * from t0 where key1 < 3 or key2 <4;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 7 Using sort_union(i1,i2); Using where
|
||||
explain
|
||||
select * from t0 where (key1 > 30 and key1<35) or (key2 >32 and key2 < 40);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 11 Using sort_union(i1,i2); Using where
|
||||
select * from t0 where (key1 > 30 and key1<35) or (key2 >32 and key2 < 40);
|
||||
key1 key2 key3 key4 key5 key6 key7 key8
|
||||
31 31 31 31 31 31 31 993
|
||||
32 32 32 32 32 32 32 992
|
||||
33 33 33 33 33 33 33 991
|
||||
34 34 34 34 34 34 34 990
|
||||
35 35 35 35 35 35 35 989
|
||||
36 36 36 36 36 36 36 988
|
||||
37 37 37 37 37 37 37 987
|
||||
38 38 38 38 38 38 38 986
|
||||
39 39 39 39 39 39 39 985
|
||||
explain select * from t0 ignore index (i2) where key1 < 3 or key2 <4;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 ALL i1 NULL NULL NULL 1024 Using where
|
||||
explain select * from t0 where (key1 < 3 or key2 <4) and key3 = 50;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 ref i1,i2,i3 i3 4 const 1 Using where
|
||||
explain select * from t0 use index (i1,i2) where (key1 < 3 or key2 <4) and key3 = 50;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 7 Using sort_union(i1,i2); Using where
|
||||
explain select * from t0 where (key1 > 1 or key2 > 2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 ALL i1,i2 NULL NULL NULL 1024 Using where
|
||||
explain select * from t0 force index (i1,i2) where (key1 > 1 or key2 > 2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 1024 Using sort_union(i1,i2); Using where
|
||||
explain
|
||||
select * from t0 where key1<3 or key2<3 or (key1>5 and key1<8) or
|
||||
(key1>10 and key1<12) or (key2>100 and key2<110);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 17 Using sort_union(i1,i2); Using where
|
||||
explain select * from t0 where key2 = 45 or key1 <=> null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 range i1,i2 i2 4 NULL 1 Using where
|
||||
explain select * from t0 where key2 = 45 or key1 is not null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 ALL i1,i2 NULL NULL NULL 1024 Using where
|
||||
explain select * from t0 where key2 = 45 or key1 is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 ref i2 i2 4 const 1
|
||||
explain select * from t0 where key2=10 or key3=3 or key4 <=> null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i2,i3,i4 i2,i3 4,4 NULL 2 Using union(i2,i3); Using where
|
||||
explain select * from t0 where key2=10 or key3=3 or key4 is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i2,i3 i2,i3 4,4 NULL 2 Using union(i2,i3); Using where
|
||||
explain select key1 from t0 where (key1 <=> null) or (key2 < 5) or
|
||||
(key3=10) or (key4 <=> null);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i2,i3,i4 i2,i3 4,4 NULL 6 Using sort_union(i2,i3); Using where
|
||||
explain select key1 from t0 where (key1 <=> null) or (key1 < 5) or
|
||||
(key3=10) or (key4 <=> null);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i3,i4 i1,i3 4,4 NULL 6 Using sort_union(i1,i3); Using where
|
||||
explain select * from t0 where
|
||||
(key1 < 3 or key2 < 3) and (key3 < 4 or key4 < 4) and (key5 < 5 or key6 < 5);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i2,i3,i4,i5,i6 i1,i2 4,4 NULL 6 Using sort_union(i1,i2); Using where
|
||||
explain
|
||||
select * from t0 where (key1 < 3 or key2 < 6) and (key1 < 7 or key3 < 4);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i2,i3 i1,i2 4,4 NULL 9 Using sort_union(i1,i2); Using where
|
||||
select * from t0 where (key1 < 3 or key2 < 6) and (key1 < 7 or key3 < 4);
|
||||
key1 key2 key3 key4 key5 key6 key7 key8
|
||||
1 1 1 1 1 1 1 1023
|
||||
2 2 2 2 2 2 2 1022
|
||||
3 3 3 3 3 3 3 1021
|
||||
4 4 4 4 4 4 4 1020
|
||||
5 5 5 5 5 5 5 1019
|
||||
explain select * from t0 where
|
||||
(key1 < 3 or key2 < 3) and (key3 < 4 or key4 < 4) and (key5 < 2 or key6 < 2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i2,i3,i4,i5,i6 i1,i2 4,4 NULL 6 Using sort_union(i1,i2); Using where
|
||||
explain select * from t0 where
|
||||
(key1 < 3 or key2 < 3) and (key3 < 100);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 range i1,i2,i3 i3 4 NULL 95 Using where
|
||||
explain select * from t0 where
|
||||
(key1 < 3 or key2 < 3) and (key3 < 1000);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 ALL i1,i2,i3 NULL NULL NULL 1024 Using where
|
||||
explain select * from t0 where
|
||||
((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
|
||||
or
|
||||
key2 > 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 ALL i1,i2,i3 NULL NULL NULL 1024 Using where
|
||||
explain select * from t0 where
|
||||
((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
|
||||
or
|
||||
key1 < 7;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i2,i3 i1,i2 4,4 NULL 10 Using sort_union(i1,i2); Using where
|
||||
select * from t0 where
|
||||
((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
|
||||
or
|
||||
key1 < 7;
|
||||
key1 key2 key3 key4 key5 key6 key7 key8
|
||||
1 1 1 1 1 1 1 1023
|
||||
2 2 2 2 2 2 2 1022
|
||||
3 3 3 3 3 3 3 1021
|
||||
4 4 4 4 4 4 4 1020
|
||||
5 5 5 5 5 5 5 1019
|
||||
6 6 6 6 6 6 6 1018
|
||||
explain select * from t0 where
|
||||
((key1 < 4 or key2 < 4) and (key3 <5 or key5 < 4))
|
||||
or
|
||||
((key5 < 5 or key6 < 6) and (key7 <7 or key8 < 4));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i2,i3,i5,i6,i7,i8 i1,i2,i5,i6 4,4,4,4 NULL 19 Using sort_union(i1,i2,i5,i6); Using where
|
||||
explain select * from t0 where
|
||||
((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
|
||||
or
|
||||
((key7 <7 or key8 < 4) and (key5 < 5 or key6 < 6));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i2,i3,i5,i6,i7,i8 i3,i5,i7,i8 4,4,4,4 NULL 20 Using sort_union(i3,i5,i7,i8); Using where
|
||||
explain select * from t0 where
|
||||
((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
|
||||
or
|
||||
((key3 <7 or key5 < 2) and (key5 < 5 or key6 < 6));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i2,i3,i5,i6 i3,i5 4,4 NULL 11 Using sort_union(i3,i5); Using where
|
||||
explain select * from t0 where
|
||||
((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
|
||||
or
|
||||
(((key3 <7 and key7 < 6) or key5 < 2) and (key5 < 5 or key6 < 6));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i2,i3,i5,i6,i7 i3,i5 4,4 NULL 11 Using sort_union(i3,i5); Using where
|
||||
explain select * from t0 where
|
||||
((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
|
||||
or
|
||||
((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 ALL i1,i2,i3,i5,i6 NULL NULL NULL 1024 Using where
|
||||
explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where
|
||||
((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
|
||||
or
|
||||
((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i2,i3,i5,i6 i3,i5 0,4 NULL 1024 Using sort_union(i3,i5); Using where
|
||||
select * from t0 where key1 < 5 or key8 < 4 order by key1;
|
||||
key1 key2 key3 key4 key5 key6 key7 key8
|
||||
1 1 1 1 1 1 1 1023
|
||||
2 2 2 2 2 2 2 1022
|
||||
3 3 3 3 3 3 3 1021
|
||||
4 4 4 4 4 4 4 1020
|
||||
1021 1021 1021 1021 1021 1021 1021 3
|
||||
1022 1022 1022 1022 1022 1022 1022 2
|
||||
1023 1023 1023 1023 1023 1023 1023 1
|
||||
1024 1024 1024 1024 1024 1024 1024 0
|
||||
explain
|
||||
select * from t0 where key1 < 5 or key8 < 4 order by key1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i8 i1,i8 4,4 NULL 9 Using sort_union(i1,i8); Using where; Using filesort
|
||||
create table t2 like t0;
|
||||
insert into t2 select * from t0;
|
||||
alter table t2 add index i1_3(key1, key3);
|
||||
alter table t2 add index i2_3(key2, key3);
|
||||
alter table t2 drop index i1;
|
||||
alter table t2 drop index i2;
|
||||
alter table t2 add index i321(key3, key2, key1);
|
||||
explain select key3 from t2 where key1 = 100 or key2 = 100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 index_merge i1_3,i2_3 i1_3,i2_3 4,4 NULL 2 Using sort_union(i1_3,i2_3); Using where
|
||||
explain select key3 from t2 where key1 <100 or key2 < 100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 index i1_3,i2_3 i321 12 NULL 1024 Using where; Using index
|
||||
explain select key7 from t2 where key1 <100 or key2 < 100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL i1_3,i2_3 NULL NULL NULL 1024 Using where
|
||||
create table t4 (
|
||||
key1a int not null,
|
||||
key1b int not null,
|
||||
key2 int not null,
|
||||
key2_1 int not null,
|
||||
key2_2 int not null,
|
||||
key3 int not null,
|
||||
index i1a (key1a, key1b),
|
||||
index i1b (key1b, key1a),
|
||||
index i2_1(key2, key2_1),
|
||||
index i2_2(key2, key2_1)
|
||||
);
|
||||
insert into t4 select key1,key1,key1 div 10, key1 % 10, key1 % 10, key1 from t0;
|
||||
select * from t4 where key1a = 3 or key1b = 4;
|
||||
key1a key1b key2 key2_1 key2_2 key3
|
||||
3 3 0 3 3 3
|
||||
4 4 0 4 4 4
|
||||
explain select * from t4 where key1a = 3 or key1b = 4;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t4 index_merge i1a,i1b i1a,i1b 4,4 NULL 2 Using sort_union(i1a,i1b); Using where
|
||||
explain select * from t4 where key2 = 1 and (key2_1 = 1 or key3 = 5);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t4 ref i2_1,i2_2 i2_1 4 const 10 Using where
|
||||
explain select * from t4 where key2 = 1 and (key2_1 = 1 or key2_2 = 5);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t4 ref i2_1,i2_2 i2_1 4 const 10 Using where
|
||||
explain select * from t4 where key2_1 = 1 or key2_2 = 5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 1024 Using where
|
||||
create table t1 like t0;
|
||||
insert into t1 select * from t0;
|
||||
explain select * from t0 left join t1 on (t0.key1=t1.key1)
|
||||
where t0.key1=3 or t0.key2=4;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
|
||||
1 SIMPLE t1 ref i1 i1 4 test.t0.key1 1
|
||||
select * from t0 left join t1 on (t0.key1=t1.key1)
|
||||
where t0.key1=3 or t0.key2=4;
|
||||
key1 key2 key3 key4 key5 key6 key7 key8 key1 key2 key3 key4 key5 key6 key7 key8
|
||||
3 3 3 3 3 3 3 1021 3 3 3 3 3 3 3 1021
|
||||
4 4 4 4 4 4 4 1020 4 4 4 4 4 4 4 1020
|
||||
explain
|
||||
select * from t0,t1 where (t0.key1=t1.key1) and ( t0.key1=3 or t0.key2=4);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
|
||||
1 SIMPLE t1 ref i1 i1 4 test.t0.key1 1
|
||||
explain
|
||||
select * from t0,t1 where (t0.key1=t1.key1) and
|
||||
(t0.key1=3 or t0.key2=4) and t1.key1<200;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 ALL i1,i2 NULL NULL NULL 1024 Using where
|
||||
1 SIMPLE t1 ref i1 i1 4 test.t0.key1 1
|
||||
explain
|
||||
select * from t0,t1 where (t0.key1=t1.key1) and
|
||||
(t0.key1=3 or t0.key2<4) and t1.key1=2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 ref i1,i2 i1 4 const 1 Using where
|
||||
1 SIMPLE t1 ref i1 i1 4 const 1
|
||||
explain select * from t0,t1 where t0.key1 = 5 and
|
||||
(t1.key1 = t0.key1 or t1.key8 = t0.key1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 ref i1 i1 4 const 1
|
||||
1 SIMPLE t1 index_merge i1,i8 i1,i8 4,4 NULL 2 Using union(i1,i8); Using where
|
||||
explain select * from t0,t1 where t0.key1 < 3 and
|
||||
(t1.key1 = t0.key1 or t1.key8 = t0.key1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 range i1 i1 4 NULL 3 Using where
|
||||
1 SIMPLE t1 ALL i1,i8 NULL NULL NULL 1024 Range checked for each record (index map: 0x81)
|
||||
explain select * from t1 where key1=3 or key2=4
|
||||
union select * from t1 where key1<4 or key3=5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
|
||||
2 UNION t1 index_merge i1,i3 i1,i3 4,4 NULL 5 Using sort_union(i1,i3); Using where
|
||||
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
|
||||
explain select * from (select * from t1 where key1 = 3 or key2 =3) as Z where key8 >5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||
2 DERIVED t1 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
|
||||
create table t3 like t0;
|
||||
insert into t3 select * from t0;
|
||||
alter table t3 add key9 int not null, add index i9(key9);
|
||||
alter table t3 add keyA int not null, add index iA(keyA);
|
||||
alter table t3 add keyB int not null, add index iB(keyB);
|
||||
alter table t3 add keyC int not null, add index iC(keyC);
|
||||
update t3 set key9=key1,keyA=key1,keyB=key1,keyC=key1;
|
||||
explain select * from t3 where
|
||||
key1=1 or key2=2 or key3=3 or key4=4 or
|
||||
key5=5 or key6=6 or key7=7 or key8=8 or
|
||||
key9=9 or keyA=10 or keyB=11 or keyC=12;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t3 index_merge i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC 4,4,4,4,4,4,4,4,4,4,4,4 NULL 12 Using union(i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC); Using where
|
||||
select * from t3 where
|
||||
key1=1 or key2=2 or key3=3 or key4=4 or
|
||||
key5=5 or key6=6 or key7=7 or key8=8 or
|
||||
key9=9 or keyA=10 or keyB=11 or keyC=12;
|
||||
key1 key2 key3 key4 key5 key6 key7 key8 key9 keyA keyB keyC
|
||||
1 1 1 1 1 1 1 1023 1 1 1 1
|
||||
2 2 2 2 2 2 2 1022 2 2 2 2
|
||||
3 3 3 3 3 3 3 1021 3 3 3 3
|
||||
4 4 4 4 4 4 4 1020 4 4 4 4
|
||||
5 5 5 5 5 5 5 1019 5 5 5 5
|
||||
6 6 6 6 6 6 6 1018 6 6 6 6
|
||||
7 7 7 7 7 7 7 1017 7 7 7 7
|
||||
9 9 9 9 9 9 9 1015 9 9 9 9
|
||||
10 10 10 10 10 10 10 1014 10 10 10 10
|
||||
11 11 11 11 11 11 11 1013 11 11 11 11
|
||||
12 12 12 12 12 12 12 1012 12 12 12 12
|
||||
1016 1016 1016 1016 1016 1016 1016 8 1016 1016 1016 1016
|
||||
explain select * from t0 where key1 < 3 or key2 < 4;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 7 Using sort_union(i1,i2); Using where
|
||||
select * from t0 where key1 < 3 or key2 < 4;
|
||||
key1 key2 key3 key4 key5 key6 key7 key8
|
||||
1 1 1 1 1 1 1 1023
|
||||
2 2 2 2 2 2 2 1022
|
||||
3 3 3 3 3 3 3 1021
|
||||
update t0 set key8=123 where key1 < 3 or key2 < 4;
|
||||
select * from t0 where key1 < 3 or key2 < 4;
|
||||
key1 key2 key3 key4 key5 key6 key7 key8
|
||||
1 1 1 1 1 1 1 123
|
||||
2 2 2 2 2 2 2 123
|
||||
3 3 3 3 3 3 3 123
|
||||
delete from t0 where key1 < 3 or key2 < 4;
|
||||
select * from t0 where key1 < 3 or key2 < 4;
|
||||
key1 key2 key3 key4 key5 key6 key7 key8
|
||||
select count(*) from t0;
|
||||
count(*)
|
||||
1021
|
||||
drop table t4;
|
||||
create table t4 (a int);
|
||||
insert into t4 values (1),(4),(3);
|
||||
set @save_join_buffer_size=@@join_buffer_size;
|
||||
set join_buffer_size= 4000;
|
||||
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
|
||||
where (A.key1 < 500000 or A.key2 < 3)
|
||||
and (B.key1 < 500000 or B.key2 < 3);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE A index_merge i1,i2 i1,i2 4,4 NULL 1013 Using sort_union(i1,i2); Using where
|
||||
1 SIMPLE B index_merge i1,i2 i1,i2 4,4 NULL 1013 Using sort_union(i1,i2); Using where
|
||||
select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
|
||||
where (A.key1 < 500000 or A.key2 < 3)
|
||||
and (B.key1 < 500000 or B.key2 < 3);
|
||||
max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
10240
|
||||
update t0 set key1=1;
|
||||
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
|
||||
where (A.key1 = 1 or A.key2 = 1)
|
||||
and (B.key1 = 1 or B.key2 = 1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE A index_merge i1,i2 i1,i2 4,4 NULL 1020 Using union(i1,i2); Using where
|
||||
1 SIMPLE B index_merge i1,i2 i1,i2 4,4 NULL 1020 Using union(i1,i2); Using where
|
||||
select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
|
||||
where (A.key1 = 1 or A.key2 = 1)
|
||||
and (B.key1 = 1 or B.key2 = 1);
|
||||
max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
8194
|
||||
alter table t0 add filler1 char(200), add filler2 char(200), add filler3 char(200);
|
||||
update t0 set key2=1, key3=1, key4=1, key5=1,key6=1,key7=1 where key7 < 500;
|
||||
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
from t0 as A, t0 as B
|
||||
where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
|
||||
and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE A index_merge i1,i2,i3,i4,i5,i6,i7?,i8 i2,i3,i4,i5,i6,i7?,i8 X NULL # Using union(intersect(i2,i3,i4,i5,i6,i7?),i8); Using where
|
||||
1 SIMPLE B index_merge i1,i2,i3,i4,i5,i6,i7?,i8 i2,i3,i4,i5,i6,i7?,i8 X NULL # Using union(intersect(i2,i3,i4,i5,i6,i7?),i8); Using where
|
||||
select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
from t0 as A, t0 as B
|
||||
where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1)
|
||||
and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1);
|
||||
max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
|
||||
8186
|
||||
set join_buffer_size= @save_join_buffer_size;
|
||||
drop table t0, t1, t2, t3, t4;
|
||||
CREATE TABLE t1 (
|
||||
cola char(3) not null, colb char(3) not null, filler char(200),
|
||||
key(cola), key(colb)
|
||||
);
|
||||
INSERT INTO t1 VALUES ('foo','bar', 'ZZ'),('fuz','baz', 'ZZ');
|
||||
OPTIMIZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize status OK
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
8704
|
||||
explain select * from t1 WHERE cola = 'foo' AND colb = 'bar';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge cola,colb cola,colb 3,3 NULL 32 Using intersect(cola,colb); Using where
|
||||
explain select * from t1 force index(cola,colb) WHERE cola = 'foo' AND colb = 'bar';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge cola,colb cola,colb 3,3 NULL 32 Using intersect(cola,colb); Using where
|
||||
drop table t1;
|
||||
create table t0 (a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
create table t1 (
|
||||
a int, b int,
|
||||
filler1 char(200), filler2 char(200),
|
||||
key(a),key(b)
|
||||
);
|
||||
insert into t1 select @v:= A.a, @v, 't1', 'filler2' from t0 A, t0 B, t0 C;
|
||||
create table t2 like t1;
|
||||
create table t3 (
|
||||
a int, b int,
|
||||
filler1 char(200), filler2 char(200),
|
||||
key(a),key(b)
|
||||
) engine=merge union=(t1,t2);
|
||||
explain select * from t1 where a=1 and b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge a,b a,b 5,5 NULL # Using intersect(a,b); Using where
|
||||
explain select * from t3 where a=1 and b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t3 index_merge a,b a,b 5,5 NULL # Using intersect(a,b); Using where
|
||||
drop table t3;
|
||||
drop table t0, t1, t2;
|
|
@ -1,11 +1,13 @@
|
|||
#---------------- Index merge test 2 -------------------------------------------
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
drop table if exists t1,t2;
|
||||
create table t1
|
||||
(
|
||||
key1 int not null,
|
||||
key2 int not null,
|
||||
key1 int not null,
|
||||
key2 int not null,
|
||||
INDEX i1(key1),
|
||||
INDEX i2(key2)
|
||||
) engine=innodb;
|
||||
);
|
||||
explain select * from t1 where key1 < 5 or key2 > 197;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where
|
||||
|
@ -26,7 +28,7 @@ key1 key2
|
|||
2 198
|
||||
3 197
|
||||
4 196
|
||||
alter table t1 add str1 char (255) not null,
|
||||
alter table t1 add str1 char (255) not null,
|
||||
add zeroval int not null default 0,
|
||||
add str2 char (255) not null,
|
||||
add str3 char (255) not null;
|
||||
|
@ -60,7 +62,7 @@ key2 integer not null,
|
|||
filler char (200),
|
||||
index (key1),
|
||||
index (key2)
|
||||
) engine=innodb;
|
||||
);
|
||||
show warnings;
|
||||
Level Code Message
|
||||
explain select pk from t1 where key1 = 1 and key2 = 1;
|
||||
|
@ -91,14 +93,14 @@ filler1 char (200),
|
|||
index i1(key1a, key1b),
|
||||
index i2(key2a, key2b),
|
||||
index i3(key3a, key3b)
|
||||
) engine=innodb;
|
||||
);
|
||||
create table t2 (a int);
|
||||
insert into t2 values (0),(1),(2),(3),(4),(NULL);
|
||||
insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
|
||||
insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
|
||||
select A.a, B.a, C.a, D.a, C.a, D.a from t2 A,t2 B,t2 C, t2 D;
|
||||
insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
|
||||
insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
|
||||
select key1a, key1b, key2a, key2b, key3a, key3b from t1;
|
||||
insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
|
||||
insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
|
||||
select key1a, key1b, key2a, key2b, key3a, key3b from t1;
|
||||
analyze table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
|
@ -106,19 +108,19 @@ test.t1 analyze status OK
|
|||
select count(*) from t1;
|
||||
count(*)
|
||||
5184
|
||||
explain select count(*) from t1 where
|
||||
explain select count(*) from t1 where
|
||||
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge i1,i2 i1,i2 10,10 NULL 4 Using intersect(i1,i2); Using where; Using index
|
||||
select count(*) from t1 where
|
||||
select count(*) from t1 where
|
||||
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
|
||||
count(*)
|
||||
4
|
||||
explain select count(*) from t1 where
|
||||
explain select count(*) from t1 where
|
||||
key1a = 2 and key1b is null and key3a = 2 and key3b is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge i1,i3 i1,i3 10,10 NULL 4 Using intersect(i1,i3); Using where; Using index
|
||||
select count(*) from t1 where
|
||||
select count(*) from t1 where
|
||||
key1a = 2 and key1b is null and key3a = 2 and key3b is null;
|
||||
count(*)
|
||||
4
|
||||
|
@ -127,8 +129,8 @@ create table t1 (
|
|||
id1 int,
|
||||
id2 date ,
|
||||
index idx2 (id1,id2),
|
||||
index idx1 (id2)
|
||||
) engine = innodb;
|
||||
index idx1 (id2)
|
||||
);
|
||||
insert into t1 values(1,'20040101'), (2,'20040102');
|
||||
select * from t1 where id1 = 1 and id2= '20040101';
|
||||
id1 id2
|
||||
|
@ -147,8 +149,8 @@ PRIMARY KEY (`oid`),
|
|||
KEY `fk_bbk_niederlassung` (`fk_bbk_niederlassung`),
|
||||
KEY `fk_wochentag` (`fk_wochentag`),
|
||||
KEY `ix_version` (`version`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
insert into t1 values
|
||||
) DEFAULT CHARSET=latin1;
|
||||
insert into t1 values
|
||||
(1, 38, 1, '08:00:00', '13:00:00', 0, 1),
|
||||
(2, 38, 2, '08:00:00', '13:00:00', 0, 1),
|
||||
(3, 38, 3, '08:00:00', '13:00:00', 0, 1),
|
||||
|
@ -174,25 +176,25 @@ insert into t1 values
|
|||
(23, 7, 3, '08:00:00', '13:00:00', 0, 1),
|
||||
(24, 7, 4, '08:00:00', '13:00:00', 0, 1),
|
||||
(25, 7, 5, '08:00:00', '13:00:00', 0, 1);
|
||||
create view v1 as
|
||||
select
|
||||
zeit1.oid AS oid,
|
||||
create view v1 as
|
||||
select
|
||||
zeit1.oid AS oid,
|
||||
zeit1.fk_bbk_niederlassung AS fk_bbk_niederlassung,
|
||||
zeit1.fk_wochentag AS fk_wochentag,
|
||||
zeit1.uhrzeit_von AS uhrzeit_von,
|
||||
zeit1.uhrzeit_bis AS uhrzeit_bis,
|
||||
zeit1.uhrzeit_von AS uhrzeit_von,
|
||||
zeit1.uhrzeit_bis AS uhrzeit_bis,
|
||||
zeit1.geloescht AS geloescht,
|
||||
zeit1.version AS version
|
||||
from
|
||||
from
|
||||
t1 zeit1
|
||||
where
|
||||
(zeit1.version =
|
||||
where
|
||||
(zeit1.version =
|
||||
(select max(zeit2.version) AS `max(version)`
|
||||
from t1 zeit2
|
||||
where
|
||||
((zeit1.fk_bbk_niederlassung = zeit2.fk_bbk_niederlassung) and
|
||||
(zeit1.fk_wochentag = zeit2.fk_wochentag) and
|
||||
(zeit1.uhrzeit_von = zeit2.uhrzeit_von) and
|
||||
from t1 zeit2
|
||||
where
|
||||
((zeit1.fk_bbk_niederlassung = zeit2.fk_bbk_niederlassung) and
|
||||
(zeit1.fk_wochentag = zeit2.fk_wochentag) and
|
||||
(zeit1.uhrzeit_von = zeit2.uhrzeit_von) and
|
||||
(zeit1.uhrzeit_bis = zeit2.uhrzeit_bis)
|
||||
)
|
||||
)
|
||||
|
@ -213,7 +215,7 @@ filler2 char(250) default NULL,
|
|||
PRIMARY KEY (t_cpac,t_vers,t_rele,t_cust),
|
||||
UNIQUE KEY IX_4 (t_cust,t_cpac,t_vers,t_rele),
|
||||
KEY IX_5 (t_vers,t_rele,t_cust)
|
||||
) ENGINE=InnoDB;
|
||||
);
|
||||
insert into t1 values
|
||||
('tm','2.5 ','a ',' ','',''), ('tm','2.5U','a ','stnd','',''),
|
||||
('da','3.3 ','b ',' ','',''), ('da','3.3U','b ','stnd','',''),
|
||||
|
@ -275,10 +277,267 @@ primary key (pk),
|
|||
key idx1(a,b,c),
|
||||
key idx2(c),
|
||||
key idx3(kp1,kp2,kp3,kp4,kp5)
|
||||
) engine=innodb default charset=latin1;
|
||||
) default charset=latin1;
|
||||
set @fill=NULL;
|
||||
SELECT COUNT(*) FROM t1 WHERE b = 0 AND a = 0 AND c = 13286427 AND
|
||||
SELECT COUNT(*) FROM t1 WHERE b = 0 AND a = 0 AND c = 13286427 AND
|
||||
kp1='279' AND kp2='ELM0678' AND kp3='6' AND kp4='10' AND kp5 = 'R ';
|
||||
COUNT(*)
|
||||
1
|
||||
drop table t1;
|
||||
#---------------- 2-sweeps read Index merge test 2 -------------------------------
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
drop table if exists t1;
|
||||
create table t1 (
|
||||
pk int primary key,
|
||||
key1 int,
|
||||
key2 int,
|
||||
filler char(200),
|
||||
filler2 char(200),
|
||||
index(key1),
|
||||
index(key2)
|
||||
);
|
||||
select * from t1 where (key1 >= 2 and key1 <= 10) or (pk >= 4 and pk <=8 );
|
||||
pk key1 key2 filler filler2
|
||||
2 2 2 filler-data filler-data-2
|
||||
3 3 3 filler-data filler-data-2
|
||||
9 9 9 filler-data filler-data-2
|
||||
10 10 10 filler-data filler-data-2
|
||||
4 4 4 filler-data filler-data-2
|
||||
5 5 5 filler-data filler-data-2
|
||||
6 6 6 filler-data filler-data-2
|
||||
7 7 7 filler-data filler-data-2
|
||||
8 8 8 filler-data filler-data-2
|
||||
set @maxv=1000;
|
||||
select * from t1 where
|
||||
(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
|
||||
or key1=18 or key1=60;
|
||||
pk key1 key2 filler filler2
|
||||
18 18 18 filler-data filler-data-2
|
||||
60 60 60 filler-data filler-data-2
|
||||
1 1 1 filler-data filler-data-2
|
||||
2 2 2 filler-data filler-data-2
|
||||
3 3 3 filler-data filler-data-2
|
||||
4 4 4 filler-data filler-data-2
|
||||
11 11 11 filler-data filler-data-2
|
||||
12 12 12 filler-data filler-data-2
|
||||
13 13 13 filler-data filler-data-2
|
||||
14 14 14 filler-data filler-data-2
|
||||
50 50 50 filler-data filler-data-2
|
||||
51 51 51 filler-data filler-data-2
|
||||
52 52 52 filler-data filler-data-2
|
||||
53 53 53 filler-data filler-data-2
|
||||
54 54 54 filler-data filler-data-2
|
||||
991 991 991 filler-data filler-data-2
|
||||
992 992 992 filler-data filler-data-2
|
||||
993 993 993 filler-data filler-data-2
|
||||
994 994 994 filler-data filler-data-2
|
||||
995 995 995 filler-data filler-data-2
|
||||
996 996 996 filler-data filler-data-2
|
||||
997 997 997 filler-data filler-data-2
|
||||
998 998 998 filler-data filler-data-2
|
||||
999 999 999 filler-data filler-data-2
|
||||
1000 1000 1000 filler-data filler-data-2
|
||||
select * from t1 where
|
||||
(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
|
||||
or key1 < 3 or key1 > @maxv-11;
|
||||
pk key1 key2 filler filler2
|
||||
990 990 990 filler-data filler-data-2
|
||||
1 1 1 filler-data filler-data-2
|
||||
2 2 2 filler-data filler-data-2
|
||||
3 3 3 filler-data filler-data-2
|
||||
4 4 4 filler-data filler-data-2
|
||||
11 11 11 filler-data filler-data-2
|
||||
12 12 12 filler-data filler-data-2
|
||||
13 13 13 filler-data filler-data-2
|
||||
14 14 14 filler-data filler-data-2
|
||||
50 50 50 filler-data filler-data-2
|
||||
51 51 51 filler-data filler-data-2
|
||||
52 52 52 filler-data filler-data-2
|
||||
53 53 53 filler-data filler-data-2
|
||||
54 54 54 filler-data filler-data-2
|
||||
991 991 991 filler-data filler-data-2
|
||||
992 992 992 filler-data filler-data-2
|
||||
993 993 993 filler-data filler-data-2
|
||||
994 994 994 filler-data filler-data-2
|
||||
995 995 995 filler-data filler-data-2
|
||||
996 996 996 filler-data filler-data-2
|
||||
997 997 997 filler-data filler-data-2
|
||||
998 998 998 filler-data filler-data-2
|
||||
999 999 999 filler-data filler-data-2
|
||||
1000 1000 1000 filler-data filler-data-2
|
||||
select * from t1 where
|
||||
(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
|
||||
or
|
||||
(key1 < 5) or (key1 > 10 and key1 < 15) or (key1 >= 50 and key1 < 55 ) or (key1 > @maxv-10);
|
||||
pk key1 key2 filler filler2
|
||||
1 1 1 filler-data filler-data-2
|
||||
2 2 2 filler-data filler-data-2
|
||||
3 3 3 filler-data filler-data-2
|
||||
4 4 4 filler-data filler-data-2
|
||||
11 11 11 filler-data filler-data-2
|
||||
12 12 12 filler-data filler-data-2
|
||||
13 13 13 filler-data filler-data-2
|
||||
14 14 14 filler-data filler-data-2
|
||||
50 50 50 filler-data filler-data-2
|
||||
51 51 51 filler-data filler-data-2
|
||||
52 52 52 filler-data filler-data-2
|
||||
53 53 53 filler-data filler-data-2
|
||||
54 54 54 filler-data filler-data-2
|
||||
991 991 991 filler-data filler-data-2
|
||||
992 992 992 filler-data filler-data-2
|
||||
993 993 993 filler-data filler-data-2
|
||||
994 994 994 filler-data filler-data-2
|
||||
995 995 995 filler-data filler-data-2
|
||||
996 996 996 filler-data filler-data-2
|
||||
997 997 997 filler-data filler-data-2
|
||||
998 998 998 filler-data filler-data-2
|
||||
999 999 999 filler-data filler-data-2
|
||||
1000 1000 1000 filler-data filler-data-2
|
||||
select * from t1 where
|
||||
(pk > 10 and pk < 15) or (pk >= 50 and pk < 55 )
|
||||
or
|
||||
(key1 < 5) or (key1 > @maxv-10);
|
||||
pk key1 key2 filler filler2
|
||||
1 1 1 filler-data filler-data-2
|
||||
2 2 2 filler-data filler-data-2
|
||||
3 3 3 filler-data filler-data-2
|
||||
4 4 4 filler-data filler-data-2
|
||||
991 991 991 filler-data filler-data-2
|
||||
992 992 992 filler-data filler-data-2
|
||||
993 993 993 filler-data filler-data-2
|
||||
994 994 994 filler-data filler-data-2
|
||||
995 995 995 filler-data filler-data-2
|
||||
996 996 996 filler-data filler-data-2
|
||||
997 997 997 filler-data filler-data-2
|
||||
998 998 998 filler-data filler-data-2
|
||||
999 999 999 filler-data filler-data-2
|
||||
1000 1000 1000 filler-data filler-data-2
|
||||
11 11 11 filler-data filler-data-2
|
||||
12 12 12 filler-data filler-data-2
|
||||
13 13 13 filler-data filler-data-2
|
||||
14 14 14 filler-data filler-data-2
|
||||
50 50 50 filler-data filler-data-2
|
||||
51 51 51 filler-data filler-data-2
|
||||
52 52 52 filler-data filler-data-2
|
||||
53 53 53 filler-data filler-data-2
|
||||
54 54 54 filler-data filler-data-2
|
||||
drop table t1;
|
||||
#---------------- Clustered PK ROR-index_merge tests -----------------------------
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
drop table if exists t1;
|
||||
create table t1
|
||||
(
|
||||
pk1 int not null,
|
||||
pk2 int not null,
|
||||
key1 int not null,
|
||||
key2 int not null,
|
||||
pktail1ok int not null,
|
||||
pktail2ok int not null,
|
||||
pktail3bad int not null,
|
||||
pktail4bad int not null,
|
||||
pktail5bad int not null,
|
||||
pk2copy int not null,
|
||||
badkey int not null,
|
||||
filler1 char (200),
|
||||
filler2 char (200),
|
||||
key (key1),
|
||||
key (key2),
|
||||
/* keys with tails from CPK members */
|
||||
key (pktail1ok, pk1),
|
||||
key (pktail2ok, pk1, pk2),
|
||||
key (pktail3bad, pk2, pk1),
|
||||
key (pktail4bad, pk1, pk2copy),
|
||||
key (pktail5bad, pk1, pk2, pk2copy),
|
||||
primary key (pk1, pk2)
|
||||
);
|
||||
explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 9 Using where
|
||||
select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
|
||||
pk1 pk2 key1 key2 pktail1ok pktail2ok pktail3bad pktail4bad pktail5bad pk2copy badkey filler1 filler2
|
||||
1 10 0 0 0 0 0 0 0 10 0 filler-data-10 filler2
|
||||
1 11 0 0 0 0 0 0 0 11 0 filler-data-11 filler2
|
||||
1 12 0 0 0 0 0 0 0 12 0 filler-data-12 filler2
|
||||
1 13 0 0 0 0 0 0 0 13 0 filler-data-13 filler2
|
||||
1 14 0 0 0 0 0 0 0 14 0 filler-data-14 filler2
|
||||
1 15 0 0 0 0 0 0 0 15 0 filler-data-15 filler2
|
||||
1 16 0 0 0 0 0 0 0 16 0 filler-data-16 filler2
|
||||
1 17 0 0 0 0 0 0 0 17 0 filler-data-17 filler2
|
||||
1 18 0 0 0 0 0 0 0 18 0 filler-data-18 filler2
|
||||
1 19 0 0 0 0 0 0 0 19 0 filler-data-19 filler2
|
||||
explain select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where; Using index
|
||||
select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1;
|
||||
pk1 pk2
|
||||
95 50
|
||||
95 51
|
||||
95 52
|
||||
95 53
|
||||
95 54
|
||||
95 55
|
||||
95 56
|
||||
95 57
|
||||
95 58
|
||||
95 59
|
||||
explain select * from t1 where badkey=1 and key1=10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref key1 key1 4 const 100 Using where
|
||||
explain select * from t1 where pk1 < 7500 and key1 = 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge PRIMARY,key1 key1,PRIMARY 4,4 NULL ROWS Using intersect(key1,PRIMARY); Using where
|
||||
explain select * from t1 where pktail1ok=1 and key1=10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,pktail1ok key1,pktail1ok 4,4 NULL 1 Using intersect(key1,pktail1ok); Using where
|
||||
explain select * from t1 where pktail2ok=1 and key1=10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,pktail2ok key1,pktail2ok 4,4 NULL 1 Using intersect(key1,pktail2ok); Using where
|
||||
explain select * from t1 where (pktail2ok=1 and pk1< 50000) or key1=10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge PRIMARY,key1,pktail2ok pktail2ok,key1 8,4 NULL 199 Using sort_union(pktail2ok,key1); Using where
|
||||
explain select * from t1 where pktail3bad=1 and key1=10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref key1,pktail3bad key1 4 const 100 Using where
|
||||
explain select * from t1 where pktail4bad=1 and key1=10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref key1,pktail4bad key1 4 const 100 Using where
|
||||
explain select * from t1 where pktail5bad=1 and key1=10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref key1,pktail5bad key1 4 const 100 Using where
|
||||
explain select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where; Using index
|
||||
select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10;
|
||||
pk1 pk2 key1 key2
|
||||
95 50 10 10
|
||||
95 51 10 10
|
||||
95 52 10 10
|
||||
95 53 10 10
|
||||
95 54 10 10
|
||||
95 55 10 10
|
||||
95 56 10 10
|
||||
95 57 10 10
|
||||
95 58 10 10
|
||||
95 59 10 10
|
||||
drop table t1;
|
||||
create table t1
|
||||
(
|
||||
RUNID varchar(22),
|
||||
SUBMITNR varchar(5),
|
||||
ORDERNR char(1),
|
||||
PROGRAMM varchar(8),
|
||||
TESTID varchar(4),
|
||||
UCCHECK char(1),
|
||||
ETEXT varchar(80),
|
||||
ETEXT_TYPE char(1),
|
||||
INFO char(1),
|
||||
SEVERITY tinyint(3),
|
||||
TADIRFLAG char(1),
|
||||
PRIMARY KEY (RUNID,SUBMITNR,ORDERNR,PROGRAMM,TESTID,UCCHECK),
|
||||
KEY `TVERM~KEY` (PROGRAMM,TESTID,UCCHECK)
|
||||
) DEFAULT CHARSET=latin1;
|
||||
update t1 set `ETEXT` = '', `ETEXT_TYPE`='', `INFO`='', `SEVERITY`='', `TADIRFLAG`=''
|
||||
WHERE
|
||||
`RUNID`= '' AND `SUBMITNR`= '' AND `ORDERNR`='' AND `PROGRAMM`='' AND
|
||||
`TESTID`='' AND `UCCHECK`='';
|
||||
drop table t1;
|
||||
|
|
|
@ -1,136 +0,0 @@
|
|||
drop table if exists t1;
|
||||
create table t1 (
|
||||
pk int primary key,
|
||||
key1 int,
|
||||
key2 int,
|
||||
filler char(200),
|
||||
filler2 char(200),
|
||||
index(key1),
|
||||
index(key2)
|
||||
) engine=innodb;
|
||||
select * from t1 where (key1 >= 2 and key1 <= 10) or (pk >= 4 and pk <=8 );
|
||||
pk key1 key2 filler filler2
|
||||
2 2 2 filler-data filler-data-2
|
||||
3 3 3 filler-data filler-data-2
|
||||
9 9 9 filler-data filler-data-2
|
||||
10 10 10 filler-data filler-data-2
|
||||
4 4 4 filler-data filler-data-2
|
||||
5 5 5 filler-data filler-data-2
|
||||
6 6 6 filler-data filler-data-2
|
||||
7 7 7 filler-data filler-data-2
|
||||
8 8 8 filler-data filler-data-2
|
||||
set @maxv=1000;
|
||||
select * from t1 where
|
||||
(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
|
||||
or key1=18 or key1=60;
|
||||
pk key1 key2 filler filler2
|
||||
18 18 18 filler-data filler-data-2
|
||||
60 60 60 filler-data filler-data-2
|
||||
1 1 1 filler-data filler-data-2
|
||||
2 2 2 filler-data filler-data-2
|
||||
3 3 3 filler-data filler-data-2
|
||||
4 4 4 filler-data filler-data-2
|
||||
11 11 11 filler-data filler-data-2
|
||||
12 12 12 filler-data filler-data-2
|
||||
13 13 13 filler-data filler-data-2
|
||||
14 14 14 filler-data filler-data-2
|
||||
50 50 50 filler-data filler-data-2
|
||||
51 51 51 filler-data filler-data-2
|
||||
52 52 52 filler-data filler-data-2
|
||||
53 53 53 filler-data filler-data-2
|
||||
54 54 54 filler-data filler-data-2
|
||||
991 991 991 filler-data filler-data-2
|
||||
992 992 992 filler-data filler-data-2
|
||||
993 993 993 filler-data filler-data-2
|
||||
994 994 994 filler-data filler-data-2
|
||||
995 995 995 filler-data filler-data-2
|
||||
996 996 996 filler-data filler-data-2
|
||||
997 997 997 filler-data filler-data-2
|
||||
998 998 998 filler-data filler-data-2
|
||||
999 999 999 filler-data filler-data-2
|
||||
1000 1000 1000 filler-data filler-data-2
|
||||
select * from t1 where
|
||||
(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
|
||||
or key1 < 3 or key1 > @maxv-11;
|
||||
pk key1 key2 filler filler2
|
||||
990 990 990 filler-data filler-data-2
|
||||
1 1 1 filler-data filler-data-2
|
||||
2 2 2 filler-data filler-data-2
|
||||
3 3 3 filler-data filler-data-2
|
||||
4 4 4 filler-data filler-data-2
|
||||
11 11 11 filler-data filler-data-2
|
||||
12 12 12 filler-data filler-data-2
|
||||
13 13 13 filler-data filler-data-2
|
||||
14 14 14 filler-data filler-data-2
|
||||
50 50 50 filler-data filler-data-2
|
||||
51 51 51 filler-data filler-data-2
|
||||
52 52 52 filler-data filler-data-2
|
||||
53 53 53 filler-data filler-data-2
|
||||
54 54 54 filler-data filler-data-2
|
||||
991 991 991 filler-data filler-data-2
|
||||
992 992 992 filler-data filler-data-2
|
||||
993 993 993 filler-data filler-data-2
|
||||
994 994 994 filler-data filler-data-2
|
||||
995 995 995 filler-data filler-data-2
|
||||
996 996 996 filler-data filler-data-2
|
||||
997 997 997 filler-data filler-data-2
|
||||
998 998 998 filler-data filler-data-2
|
||||
999 999 999 filler-data filler-data-2
|
||||
1000 1000 1000 filler-data filler-data-2
|
||||
select * from t1 where
|
||||
(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
|
||||
or
|
||||
(key1 < 5) or (key1 > 10 and key1 < 15) or (key1 >= 50 and key1 < 55 ) or (key1 > @maxv-10);
|
||||
pk key1 key2 filler filler2
|
||||
1 1 1 filler-data filler-data-2
|
||||
2 2 2 filler-data filler-data-2
|
||||
3 3 3 filler-data filler-data-2
|
||||
4 4 4 filler-data filler-data-2
|
||||
11 11 11 filler-data filler-data-2
|
||||
12 12 12 filler-data filler-data-2
|
||||
13 13 13 filler-data filler-data-2
|
||||
14 14 14 filler-data filler-data-2
|
||||
50 50 50 filler-data filler-data-2
|
||||
51 51 51 filler-data filler-data-2
|
||||
52 52 52 filler-data filler-data-2
|
||||
53 53 53 filler-data filler-data-2
|
||||
54 54 54 filler-data filler-data-2
|
||||
991 991 991 filler-data filler-data-2
|
||||
992 992 992 filler-data filler-data-2
|
||||
993 993 993 filler-data filler-data-2
|
||||
994 994 994 filler-data filler-data-2
|
||||
995 995 995 filler-data filler-data-2
|
||||
996 996 996 filler-data filler-data-2
|
||||
997 997 997 filler-data filler-data-2
|
||||
998 998 998 filler-data filler-data-2
|
||||
999 999 999 filler-data filler-data-2
|
||||
1000 1000 1000 filler-data filler-data-2
|
||||
select * from t1 where
|
||||
(pk > 10 and pk < 15) or (pk >= 50 and pk < 55 )
|
||||
or
|
||||
(key1 < 5) or (key1 > @maxv-10);
|
||||
pk key1 key2 filler filler2
|
||||
1 1 1 filler-data filler-data-2
|
||||
2 2 2 filler-data filler-data-2
|
||||
3 3 3 filler-data filler-data-2
|
||||
4 4 4 filler-data filler-data-2
|
||||
991 991 991 filler-data filler-data-2
|
||||
992 992 992 filler-data filler-data-2
|
||||
993 993 993 filler-data filler-data-2
|
||||
994 994 994 filler-data filler-data-2
|
||||
995 995 995 filler-data filler-data-2
|
||||
996 996 996 filler-data filler-data-2
|
||||
997 997 997 filler-data filler-data-2
|
||||
998 998 998 filler-data filler-data-2
|
||||
999 999 999 filler-data filler-data-2
|
||||
1000 1000 1000 filler-data filler-data-2
|
||||
11 11 11 filler-data filler-data-2
|
||||
12 12 12 filler-data filler-data-2
|
||||
13 13 13 filler-data filler-data-2
|
||||
14 14 14 filler-data filler-data-2
|
||||
50 50 50 filler-data filler-data-2
|
||||
51 51 51 filler-data filler-data-2
|
||||
52 52 52 filler-data filler-data-2
|
||||
53 53 53 filler-data filler-data-2
|
||||
54 54 54 filler-data filler-data-2
|
||||
drop table t1;
|
1210
mysql-test/r/index_merge_myisam.result
Normal file
1210
mysql-test/r/index_merge_myisam.result
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,196 +0,0 @@
|
|||
drop table if exists t0,t1,t2;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
64801
|
||||
explain select key1,key2 from t1 where key1=100 and key2=100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 77 Using intersect(key1,key2); Using where; Using index
|
||||
select key1,key2 from t1 where key1=100 and key2=100;
|
||||
key1 key2
|
||||
100 100
|
||||
explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where
|
||||
select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
|
||||
key1 key2 key3 key4 filler1
|
||||
100 100 100 100 key1-key2-key3-key4
|
||||
insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, -1, -1, 'key1-key2');
|
||||
insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, 100, 100, 'key4-key3');
|
||||
explain select key1,key2,filler1 from t1 where key1=100 and key2=100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 77 Using intersect(key1,key2); Using where
|
||||
select key1,key2,filler1 from t1 where key1=100 and key2=100;
|
||||
key1 key2 filler1
|
||||
100 100 key1-key2-key3-key4
|
||||
100 100 key1-key2
|
||||
explain select key1,key2 from t1 where key1=100 and key2=100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 77 Using intersect(key1,key2); Using where; Using index
|
||||
select key1,key2 from t1 where key1=100 and key2=100;
|
||||
key1 key2
|
||||
100 100
|
||||
100 100
|
||||
explain select key1,key2,key3,key4 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where
|
||||
select key1,key2,key3,key4 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
|
||||
key1 key2 key3 key4
|
||||
100 100 100 100
|
||||
100 100 -1 -1
|
||||
-1 -1 100 100
|
||||
explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where
|
||||
select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
|
||||
key1 key2 key3 key4 filler1
|
||||
100 100 100 100 key1-key2-key3-key4
|
||||
100 100 -1 -1 key1-key2
|
||||
-1 -1 100 100 key4-key3
|
||||
explain select key1,key2,key3 from t1 where key1=100 and key2=100 and key3=100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,key2,key3 key1,key2,key3 5,5,5 NULL 2 Using intersect(key1,key2,key3); Using where; Using index
|
||||
select key1,key2,key3 from t1 where key1=100 and key2=100 and key3=100;
|
||||
key1 key2 key3
|
||||
100 100 100
|
||||
insert into t1 (key1,key2,key3,key4,filler1) values (101,101,101,101, 'key1234-101');
|
||||
explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=101;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,key2,key3 key1,key2,key3 5,5,5 NULL 83 Using union(intersect(key1,key2),key3); Using where
|
||||
select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=101;
|
||||
key1 key2 key3 key4 filler1
|
||||
100 100 100 100 key1-key2-key3-key4
|
||||
100 100 -1 -1 key1-key2
|
||||
101 101 101 101 key1234-101
|
||||
select key1,key2, filler1 from t1 where key1=100 and key2=100;
|
||||
key1 key2 filler1
|
||||
100 100 key1-key2-key3-key4
|
||||
100 100 key1-key2
|
||||
update t1 set filler1='to be deleted' where key1=100 and key2=100;
|
||||
update t1 set key1=200,key2=200 where key1=100 and key2=100;
|
||||
delete from t1 where key1=200 and key2=200;
|
||||
select key1,key2,filler1 from t1 where key2=100 and key2=200;
|
||||
key1 key2 filler1
|
||||
explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 152 Using union(intersect(key1,key2),intersect(key3,key4)); Using where
|
||||
select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
|
||||
key1 key2 key3 key4 filler1
|
||||
-1 -1 100 100 key4-key3
|
||||
delete from t1 where key3=100 and key4=100;
|
||||
explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 152 Using union(intersect(key1,key2),intersect(key3,key4)); Using where
|
||||
select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
|
||||
key1 key2 key3 key4 filler1
|
||||
explain select key1,key2 from t1 where key1=100 and key2=100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 76 Using intersect(key1,key2); Using where; Using index
|
||||
select key1,key2 from t1 where key1=100 and key2=100;
|
||||
key1 key2
|
||||
insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-1');
|
||||
insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-2');
|
||||
insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-3');
|
||||
explain select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,key2,key3,key4 key3,key1,key2,key4 5,5,5,5 NULL 136 Using union(key3,intersect(key1,key2),key4); Using where
|
||||
select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
|
||||
key1 key2 key3 key4 filler1
|
||||
100 100 200 200 key1-key2-key3-key4-3
|
||||
100 100 200 200 key1-key2-key3-key4-2
|
||||
100 100 200 200 key1-key2-key3-key4-1
|
||||
insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, -1, 200,'key4');
|
||||
explain select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,key2,key3,key4 key3,key1,key2,key4 5,5,5,5 NULL 146 Using union(key3,intersect(key1,key2),key4); Using where
|
||||
select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
|
||||
key1 key2 key3 key4 filler1
|
||||
100 100 200 200 key1-key2-key3-key4-3
|
||||
100 100 200 200 key1-key2-key3-key4-2
|
||||
100 100 200 200 key1-key2-key3-key4-1
|
||||
-1 -1 -1 200 key4
|
||||
insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, 200, -1,'key3');
|
||||
explain select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,key2,key3,key4 key3,key1,key2,key4 5,5,5,5 NULL 156 Using union(key3,intersect(key1,key2),key4); Using where
|
||||
select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200;
|
||||
key1 key2 key3 key4 filler1
|
||||
100 100 200 200 key1-key2-key3-key4-3
|
||||
100 100 200 200 key1-key2-key3-key4-2
|
||||
100 100 200 200 key1-key2-key3-key4-1
|
||||
-1 -1 -1 200 key4
|
||||
-1 -1 200 -1 key3
|
||||
explain select * from t1 where st_a=1 and st_b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b st_a,st_b 4,4 NULL 3515 Using intersect(st_a,st_b); Using where
|
||||
explain select st_a,st_b from t1 where st_a=1 and st_b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b st_a,st_b 4,4 NULL 3515 Using intersect(st_a,st_b); Using where; Using index
|
||||
explain select st_a from t1 ignore index (st_a) where st_a=1 and st_b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,stb_swt1a_2b,stb_swt1b,st_b st_b 4 const 15093 Using where
|
||||
explain select * from t1 where st_a=1 and swt1a=1 and swt2a=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a sta_swt21a 12 const,const,const 971
|
||||
explain select * from t1 where st_b=1 and swt1b=1 and swt2b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref stb_swt1a_2b,stb_swt1b,st_b stb_swt1a_2b 8 const,const 3879 Using where
|
||||
explain select * from t1 where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt12a,stb_swt1a_2b 12,12 NULL 58 Using intersect(sta_swt12a,stb_swt1a_2b); Using where
|
||||
explain select * from t1 ignore index (sta_swt21a, stb_swt1a_2b)
|
||||
where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,st_a,stb_swt1b,st_b sta_swt12a,stb_swt1b 12,8 NULL 58 Using intersect(sta_swt12a,stb_swt1b); Using where
|
||||
explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b)
|
||||
where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge sta_swt1a,sta_swt2a,st_a,stb_swt1b,st_b sta_swt1a,sta_swt2a,stb_swt1b 8,8,8 NULL 57 Using intersect(sta_swt1a,sta_swt2a,stb_swt1b); Using where
|
||||
explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b, stb_swt1b)
|
||||
where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge sta_swt1a,sta_swt2a,st_a,st_b sta_swt1a,sta_swt2a,st_b 8,8,4 NULL 223 Using intersect(sta_swt1a,sta_swt2a,st_b); Using where
|
||||
explain select * from t1
|
||||
where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt12a,stb_swt1a_2b 12,12 NULL 58 Using intersect(sta_swt12a,stb_swt1a_2b); Using where
|
||||
explain select * from t1
|
||||
where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt1a,stb_swt1b 8,8 NULL 232 Using intersect(sta_swt1a,stb_swt1b); Using where
|
||||
explain select st_a from t1
|
||||
where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt1a,stb_swt1b 8,8 NULL 232 Using intersect(sta_swt1a,stb_swt1b); Using where; Using index
|
||||
explain select st_a from t1
|
||||
where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt1a,stb_swt1b 8,8 NULL 232 Using intersect(sta_swt1a,stb_swt1b); Using where; Using index
|
||||
drop table t0,t1;
|
||||
create table t2 (
|
||||
a char(10),
|
||||
b char(10),
|
||||
filler1 char(255),
|
||||
filler2 char(255),
|
||||
key(a(5)),
|
||||
key(b(5))
|
||||
);
|
||||
select count(a) from t2 where a='BBBBBBBB';
|
||||
count(a)
|
||||
4
|
||||
select count(a) from t2 where b='BBBBBBBB';
|
||||
count(a)
|
||||
4
|
||||
expla_or_bin select count(a_or_b) from t2 where a_or_b='AAAAAAAA' a_or_bnd a_or_b='AAAAAAAA';
|
||||
id select_type ta_or_ba_or_ble type possia_or_ble_keys key key_len ref rows Extra_or_b
|
||||
1 SIMPLE t2 ref a_or_b,a_or_b a_or_b 6 const 4 Using where
|
||||
select count(a) from t2 where a='AAAAAAAA' and b='AAAAAAAA';
|
||||
count(a)
|
||||
4
|
||||
select count(a) from t2 ignore index(a,b) where a='AAAAAAAA' and b='AAAAAAAA';
|
||||
count(a)
|
||||
4
|
||||
insert into t2 values ('ab', 'ab', 'uh', 'oh');
|
||||
explain select a from t2 where a='ab';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ref a a 6 const 1 Using where
|
||||
drop table t2;
|
|
@ -1,120 +0,0 @@
|
|||
drop table if exists t1;
|
||||
create table t1
|
||||
(
|
||||
pk1 int not null,
|
||||
pk2 int not null,
|
||||
key1 int not null,
|
||||
key2 int not null,
|
||||
pktail1ok int not null,
|
||||
pktail2ok int not null,
|
||||
pktail3bad int not null,
|
||||
pktail4bad int not null,
|
||||
pktail5bad int not null,
|
||||
pk2copy int not null,
|
||||
badkey int not null,
|
||||
filler1 char (200),
|
||||
filler2 char (200),
|
||||
key (key1),
|
||||
key (key2),
|
||||
/* keys with tails from CPK members */
|
||||
key (pktail1ok, pk1),
|
||||
key (pktail2ok, pk1, pk2),
|
||||
key (pktail3bad, pk2, pk1),
|
||||
key (pktail4bad, pk1, pk2copy),
|
||||
key (pktail5bad, pk1, pk2, pk2copy),
|
||||
primary key (pk1, pk2)
|
||||
) engine=innodb;
|
||||
explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 9 Using where
|
||||
select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
|
||||
pk1 pk2 key1 key2 pktail1ok pktail2ok pktail3bad pktail4bad pktail5bad pk2copy badkey filler1 filler2
|
||||
1 10 0 0 0 0 0 0 0 10 0 filler-data-10 filler2
|
||||
1 11 0 0 0 0 0 0 0 11 0 filler-data-11 filler2
|
||||
1 12 0 0 0 0 0 0 0 12 0 filler-data-12 filler2
|
||||
1 13 0 0 0 0 0 0 0 13 0 filler-data-13 filler2
|
||||
1 14 0 0 0 0 0 0 0 14 0 filler-data-14 filler2
|
||||
1 15 0 0 0 0 0 0 0 15 0 filler-data-15 filler2
|
||||
1 16 0 0 0 0 0 0 0 16 0 filler-data-16 filler2
|
||||
1 17 0 0 0 0 0 0 0 17 0 filler-data-17 filler2
|
||||
1 18 0 0 0 0 0 0 0 18 0 filler-data-18 filler2
|
||||
1 19 0 0 0 0 0 0 0 19 0 filler-data-19 filler2
|
||||
explain select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where; Using index
|
||||
select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1;
|
||||
pk1 pk2
|
||||
95 50
|
||||
95 51
|
||||
95 52
|
||||
95 53
|
||||
95 54
|
||||
95 55
|
||||
95 56
|
||||
95 57
|
||||
95 58
|
||||
95 59
|
||||
explain select * from t1 where badkey=1 and key1=10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref key1 key1 4 const 100 Using where
|
||||
explain select * from t1 where pk1 < 7500 and key1 = 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge PRIMARY,key1 key1,PRIMARY 4,4 NULL ROWS Using intersect(key1,PRIMARY); Using where
|
||||
explain select * from t1 where pktail1ok=1 and key1=10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,pktail1ok key1,pktail1ok 4,4 NULL 1 Using intersect(key1,pktail1ok); Using where
|
||||
explain select * from t1 where pktail2ok=1 and key1=10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,pktail2ok key1,pktail2ok 4,4 NULL 1 Using intersect(key1,pktail2ok); Using where
|
||||
select ' The following is actually a deficiency, it uses sort_union currently:' as 'note:';
|
||||
note:
|
||||
The following is actually a deficiency, it uses sort_union currently:
|
||||
explain select * from t1 where (pktail2ok=1 and pk1< 50000) or key1=10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge PRIMARY,key1,pktail2ok pktail2ok,key1 8,4 NULL 199 Using sort_union(pktail2ok,key1); Using where
|
||||
explain select * from t1 where pktail3bad=1 and key1=10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref key1,pktail3bad key1 4 const 100 Using where
|
||||
explain select * from t1 where pktail4bad=1 and key1=10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref key1,pktail4bad key1 4 const 100 Using where
|
||||
explain select * from t1 where pktail5bad=1 and key1=10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref key1,pktail5bad key1 4 const 100 Using where
|
||||
explain select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where; Using index
|
||||
select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10;
|
||||
pk1 pk2 key1 key2
|
||||
95 50 10 10
|
||||
95 51 10 10
|
||||
95 52 10 10
|
||||
95 53 10 10
|
||||
95 54 10 10
|
||||
95 55 10 10
|
||||
95 56 10 10
|
||||
95 57 10 10
|
||||
95 58 10 10
|
||||
95 59 10 10
|
||||
drop table t1;
|
||||
create table t1
|
||||
(
|
||||
RUNID varchar(22),
|
||||
SUBMITNR varchar(5),
|
||||
ORDERNR char(1) ,
|
||||
PROGRAMM varchar(8),
|
||||
TESTID varchar(4),
|
||||
UCCHECK char(1),
|
||||
ETEXT varchar(80),
|
||||
ETEXT_TYPE char(1),
|
||||
INFO char(1),
|
||||
SEVERITY tinyint(3),
|
||||
TADIRFLAG char(1),
|
||||
PRIMARY KEY (RUNID,SUBMITNR,ORDERNR,PROGRAMM,TESTID,UCCHECK),
|
||||
KEY `TVERM~KEY` (PROGRAMM,TESTID,UCCHECK)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
update t1 set `ETEXT` = '', `ETEXT_TYPE`='', `INFO`='', `SEVERITY`='', `TADIRFLAG`=''
|
||||
WHERE
|
||||
`RUNID`= '' AND `SUBMITNR`= '' AND `ORDERNR`='' AND `PROGRAMM`='' AND
|
||||
`TESTID`='' AND `UCCHECK`='';
|
||||
drop table t1;
|
|
@ -1,167 +0,0 @@
|
|||
drop table if exists t1,t2;
|
||||
create table t1 (a int, b char(10), key a(a), key b(a,b)) engine=innodb;
|
||||
insert into t1 values
|
||||
(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
|
||||
(14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"),
|
||||
(20,"ggg"),(21,"hhh"),(22,"iii");
|
||||
handler t1 open as t2;
|
||||
handler t2 read a first;
|
||||
a b
|
||||
14 aaa
|
||||
handler t2 read a next;
|
||||
a b
|
||||
15 bbb
|
||||
handler t2 read a next;
|
||||
a b
|
||||
16 ccc
|
||||
handler t2 read a prev;
|
||||
a b
|
||||
15 bbb
|
||||
handler t2 read a last;
|
||||
a b
|
||||
22 iii
|
||||
handler t2 read a prev;
|
||||
a b
|
||||
21 hhh
|
||||
handler t2 read a prev;
|
||||
a b
|
||||
20 ggg
|
||||
handler t2 read a first;
|
||||
a b
|
||||
14 aaa
|
||||
handler t2 read a prev;
|
||||
a b
|
||||
handler t2 read a last;
|
||||
a b
|
||||
22 iii
|
||||
handler t2 read a prev;
|
||||
a b
|
||||
21 hhh
|
||||
handler t2 read a next;
|
||||
a b
|
||||
22 iii
|
||||
handler t2 read a next;
|
||||
a b
|
||||
handler t2 read a=(15);
|
||||
a b
|
||||
15 bbb
|
||||
handler t2 read a=(16);
|
||||
a b
|
||||
16 ccc
|
||||
handler t2 read a=(19,"fff");
|
||||
ERROR 42000: Too many key parts specified; max 1 parts allowed
|
||||
handler t2 read b=(19,"fff");
|
||||
a b
|
||||
19 fff
|
||||
handler t2 read b=(19,"yyy");
|
||||
a b
|
||||
19 yyy
|
||||
handler t2 read b=(19);
|
||||
a b
|
||||
19 fff
|
||||
handler t1 read a last;
|
||||
ERROR 42S02: Unknown table 't1' in HANDLER
|
||||
handler t2 read a=(11);
|
||||
a b
|
||||
handler t2 read a>=(11);
|
||||
a b
|
||||
14 aaa
|
||||
handler t2 read a=(18);
|
||||
a b
|
||||
18 eee
|
||||
handler t2 read a>=(18);
|
||||
a b
|
||||
18 eee
|
||||
handler t2 read a>(18);
|
||||
a b
|
||||
19 fff
|
||||
handler t2 read a<=(18);
|
||||
a b
|
||||
18 eee
|
||||
handler t2 read a<(18);
|
||||
a b
|
||||
17 ddd
|
||||
handler t2 read a first limit 5;
|
||||
a b
|
||||
14 aaa
|
||||
15 bbb
|
||||
16 ccc
|
||||
16 xxx
|
||||
17 ddd
|
||||
handler t2 read a next limit 3;
|
||||
a b
|
||||
18 eee
|
||||
19 fff
|
||||
19 yyy
|
||||
handler t2 read a prev limit 10;
|
||||
a b
|
||||
19 fff
|
||||
18 eee
|
||||
17 ddd
|
||||
16 xxx
|
||||
16 ccc
|
||||
15 bbb
|
||||
14 aaa
|
||||
handler t2 read a>=(16) limit 4;
|
||||
a b
|
||||
16 ccc
|
||||
16 xxx
|
||||
17 ddd
|
||||
18 eee
|
||||
handler t2 read a>=(16) limit 2,2;
|
||||
a b
|
||||
17 ddd
|
||||
18 eee
|
||||
handler t2 read a last limit 3;
|
||||
a b
|
||||
22 iii
|
||||
21 hhh
|
||||
20 ggg
|
||||
handler t2 read a=(19);
|
||||
a b
|
||||
19 fff
|
||||
handler t2 read a=(19) where b="yyy";
|
||||
a b
|
||||
19 yyy
|
||||
handler t2 read first;
|
||||
a b
|
||||
17 ddd
|
||||
handler t2 read next;
|
||||
a b
|
||||
18 eee
|
||||
handler t2 read last;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
|
||||
handler t2 close;
|
||||
handler t1 open;
|
||||
handler t1 read a next;
|
||||
a b
|
||||
14 aaa
|
||||
handler t1 read a next;
|
||||
a b
|
||||
15 bbb
|
||||
handler t1 close;
|
||||
handler t1 open;
|
||||
handler t1 read a prev;
|
||||
a b
|
||||
22 iii
|
||||
handler t1 read a prev;
|
||||
a b
|
||||
21 hhh
|
||||
handler t1 close;
|
||||
handler t1 open as t2;
|
||||
handler t2 read first;
|
||||
a b
|
||||
17 ddd
|
||||
alter table t1 engine=innodb;
|
||||
handler t2 read first;
|
||||
ERROR 42S02: Unknown table 't2' in HANDLER
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2);
|
||||
HANDLER t1 OPEN;
|
||||
HANDLER t1 READ `primary` = (1, 1000);
|
||||
no1 no2
|
||||
HANDLER t1 READ `primary` PREV;
|
||||
no1 no2
|
||||
1 275
|
||||
DROP TABLE t1;
|
|
@ -1,5 +1,6 @@
|
|||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
drop table if exists t1,t2,t1m,t1i,t2m,t2i,t4;
|
||||
create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
|
||||
create table t1(f1 varchar(800) binary not null, key(f1))
|
||||
character set utf8 collate utf8_general_ci;
|
||||
Warnings:
|
||||
Warning 1071 Specified key was too long; max key length is 765 bytes
|
||||
|
@ -10,7 +11,7 @@ c_id int(11) not null default '0',
|
|||
org_id int(11) default null,
|
||||
unique key contacts$c_id (c_id),
|
||||
key contacts$org_id (org_id)
|
||||
) engine=innodb;
|
||||
);
|
||||
insert into t1 values
|
||||
(2,null),(120,null),(141,null),(218,7), (128,1),
|
||||
(151,2),(234,2),(236,2),(243,2),(255,2),(259,2),(232,3),(235,3),(238,3),
|
||||
|
@ -33,7 +34,7 @@ sla_set int(11) default null,
|
|||
unique key t2$slai_id (slai_id),
|
||||
key t2$owner_id (owner_id),
|
||||
key t2$sla_id (sla_id)
|
||||
) engine=innodb;
|
||||
);
|
||||
insert into t2(slai_id, owner_tbl, owner_id, sla_id) values
|
||||
(1,3,1,1), (3,3,10,2), (4,3,3,6), (5,3,2,5), (6,3,8,3), (7,3,9,7),
|
||||
(8,3,6,8), (9,3,4,9), (10,3,5,10), (11,3,11,11), (12,3,7,12);
|
||||
|
@ -89,66 +90,12 @@ b a
|
|||
3 3
|
||||
3 3
|
||||
DROP TABLE t1, t2, t3;
|
||||
create table t1m (a int) engine=myisam;
|
||||
create table t1i (a int) engine=innodb;
|
||||
create table t2m (a int) engine=myisam;
|
||||
create table t2i (a int) engine=innodb;
|
||||
create table t1m (a int) engine = MEMORY;
|
||||
create table t1i (a int);
|
||||
create table t2m (a int) engine = MEMORY;
|
||||
create table t2i (a int);
|
||||
insert into t2m values (5);
|
||||
insert into t2i values (5);
|
||||
select min(a) from t1m;
|
||||
min(a)
|
||||
NULL
|
||||
select min(7) from t1m;
|
||||
min(7)
|
||||
NULL
|
||||
select min(7) from DUAL;
|
||||
min(7)
|
||||
NULL
|
||||
explain select min(7) from t2m join t1m;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
select min(7) from t2m join t1m;
|
||||
min(7)
|
||||
NULL
|
||||
select max(a) from t1m;
|
||||
max(a)
|
||||
NULL
|
||||
select max(7) from t1m;
|
||||
max(7)
|
||||
NULL
|
||||
select max(7) from DUAL;
|
||||
max(7)
|
||||
NULL
|
||||
explain select max(7) from t2m join t1m;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
select max(7) from t2m join t1m;
|
||||
max(7)
|
||||
NULL
|
||||
select 1, min(a) from t1m where a=99;
|
||||
1 min(a)
|
||||
1 NULL
|
||||
select 1, min(a) from t1m where 1=99;
|
||||
1 min(a)
|
||||
1 NULL
|
||||
select 1, min(1) from t1m where a=99;
|
||||
1 min(1)
|
||||
1 NULL
|
||||
select 1, min(1) from t1m where 1=99;
|
||||
1 min(1)
|
||||
1 NULL
|
||||
select 1, max(a) from t1m where a=99;
|
||||
1 max(a)
|
||||
1 NULL
|
||||
select 1, max(a) from t1m where 1=99;
|
||||
1 max(a)
|
||||
1 NULL
|
||||
select 1, max(1) from t1m where a=99;
|
||||
1 max(1)
|
||||
1 NULL
|
||||
select 1, max(1) from t1m where 1=99;
|
||||
1 max(1)
|
||||
1 NULL
|
||||
select min(a) from t1i;
|
||||
min(a)
|
||||
NULL
|
||||
|
@ -229,7 +176,7 @@ count(*) min(7) max(7)
|
|||
drop table t1m, t1i, t2m, t2i;
|
||||
create table t1 (
|
||||
a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
|
||||
);
|
||||
) ENGINE = MEMORY;
|
||||
insert into t1 (a1, a2, b, c, d) values
|
||||
('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
|
||||
('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
|
||||
|
@ -265,14 +212,14 @@ insert into t1 (a1, a2, b, c, d) values
|
|||
('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
|
||||
create table t4 (
|
||||
pk_col int auto_increment primary key, a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
|
||||
) engine=innodb;
|
||||
);
|
||||
insert into t4 (a1, a2, b, c, d, dummy) select * from t1;
|
||||
create index idx12672_0 on t4 (a1);
|
||||
create index idx12672_1 on t4 (a1,a2,b,c);
|
||||
create index idx12672_2 on t4 (a1,a2,b);
|
||||
analyze table t1;
|
||||
analyze table t4;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
test.t4 analyze status OK
|
||||
select distinct a1 from t4 where pk_col not in (1,2,3,4);
|
||||
a1
|
||||
a
|
||||
|
@ -282,18 +229,18 @@ d
|
|||
drop table t1,t4;
|
||||
create table t1 (
|
||||
a varchar(30), b varchar(30), primary key(a), key(b)
|
||||
) engine=innodb;
|
||||
);
|
||||
select distinct a from t1;
|
||||
a
|
||||
drop table t1;
|
||||
create table t1(a int, key(a)) engine=innodb;
|
||||
create table t1(a int, key(a));
|
||||
insert into t1 values(1);
|
||||
select a, count(a) from t1 group by a with rollup;
|
||||
a count(a)
|
||||
1 1
|
||||
NULL 1
|
||||
drop table t1;
|
||||
create table t1 (f1 int, f2 char(1), primary key(f1,f2)) engine=innodb;
|
||||
create table t1 (f1 int, f2 char(1), primary key(f1,f2));
|
||||
insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d");
|
||||
alter table t1 drop primary key, add primary key (f2, f1);
|
||||
explain select distinct f1 a, f1 b from t1;
|
||||
|
@ -303,7 +250,6 @@ explain select distinct f1, f2 from t1;
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary
|
||||
drop table t1;
|
||||
set storage_engine=innodb;
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
insert into t1 values (1,1),(1,2);
|
||||
CREATE TABLE t2 (primary key (a)) select * from t1;
|
||||
|
|
2475
mysql-test/r/mix2_myisam.result
Normal file
2475
mysql-test/r/mix2_myisam.result
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,3 +1,4 @@
|
|||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
drop table if exists t1, t2, t3,t4;
|
||||
create table t1 (
|
||||
pk1 int not NULL,
|
||||
|
@ -6,7 +7,7 @@ key2 int(11),
|
|||
PRIMARY KEY (pk1),
|
||||
KEY key1 (key1),
|
||||
KEY key2 (key2)
|
||||
) engine=innodb;
|
||||
);
|
||||
insert into t1 values (-5, 1, 1),
|
||||
(-100, 1, 1),
|
||||
(3, 1, 1),
|
||||
|
@ -30,7 +31,7 @@ key2 int(11),
|
|||
PRIMARY KEY (pk1),
|
||||
KEY key1 (key1),
|
||||
KEY key2 (key2)
|
||||
) engine=innodb;
|
||||
);
|
||||
insert into t1 values (0, 1, 1),
|
||||
(0xFFFFFFFF, 1, 1),
|
||||
(0xFFFFFFFE, 1, 1),
|
||||
|
@ -51,7 +52,7 @@ key2 int(11),
|
|||
PRIMARY KEY (pk1),
|
||||
KEY key1 (key1),
|
||||
KEY key2 (key2)
|
||||
) engine=innodb collate latin2_general_ci;
|
||||
) collate latin2_general_ci;
|
||||
insert into t1 values ('a1', 1, 1),
|
||||
('b2', 1, 1),
|
||||
('A3', 1, 1),
|
||||
|
@ -72,7 +73,7 @@ key2 int(11),
|
|||
PRIMARY KEY (pk1,pk2,pk3),
|
||||
KEY key1 (key1),
|
||||
KEY key2 (key2)
|
||||
) engine=innodb;
|
||||
);
|
||||
insert into t1 values
|
||||
(1, 'u', 'u', 1, 1),
|
||||
(1, 'u', char(0xEC), 1, 1),
|
||||
|
@ -170,7 +171,7 @@ key2 int(11),
|
|||
primary key(pk1, pk2),
|
||||
KEY key1 (key1),
|
||||
KEY key2 (key2)
|
||||
) engine=innodb;
|
||||
);
|
||||
insert into t1 values ('','empt',2,2),
|
||||
('a','a--a',2,2),
|
||||
('bb','b--b',2,2),
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
drop table if exists t1,t2;
|
||||
create table t1 (id int not null, f_id int not null, f int not null,
|
||||
primary key(f_id, id)) engine=innodb;
|
||||
primary key(f_id, id)) engine = InnoDB;
|
||||
create table t2 (id int not null,s_id int not null,s varchar(200),
|
||||
primary key(id)) engine=innodb;
|
||||
primary key(id)) engine = InnoDB;
|
||||
INSERT INTO t1 VALUES (8, 1, 3);
|
||||
INSERT INTO t1 VALUES (1, 2, 1);
|
||||
INSERT INTO t2 VALUES (1, 0, '');
|
||||
|
@ -14,7 +14,7 @@ select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
|
|||
where mm.id is null lock in share mode;
|
||||
id f_id f
|
||||
drop table t1,t2;
|
||||
create table t1(a int not null, b int, primary key(a)) engine=innodb;
|
||||
create table t1(a int not null, b int, primary key(a)) engine = InnoDB;
|
||||
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
|
||||
commit;
|
||||
set autocommit = 0;
|
||||
|
@ -34,7 +34,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
|||
commit;
|
||||
commit;
|
||||
drop table t1;
|
||||
create table t1(a int not null, b int, primary key(a)) engine=innodb;
|
||||
create table t1(a int not null, b int, primary key(a)) engine = InnoDB;
|
||||
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
|
||||
commit;
|
||||
set autocommit = 0;
|
||||
|
@ -46,9 +46,9 @@ a b
|
|||
commit;
|
||||
commit;
|
||||
drop table t1;
|
||||
create table t1(a int not null, b int, primary key(a)) engine=innodb;
|
||||
create table t1(a int not null, b int, primary key(a)) engine = InnoDB;
|
||||
insert into t1 values (1,2),(5,3),(4,2);
|
||||
create table t2(d int not null, e int, primary key(d)) engine=innodb;
|
||||
create table t2(d int not null, e int, primary key(d)) engine = InnoDB;
|
||||
insert into t2 values (8,6),(12,1),(3,1);
|
||||
commit;
|
||||
set autocommit = 0;
|
||||
|
@ -60,24 +60,27 @@ d e
|
|||
set autocommit = 0;
|
||||
insert into t1 select * from t2;
|
||||
update t1 set b = (select e from t2 where a = d);
|
||||
create table t3(d int not null, e int, primary key(d)) engine=innodb
|
||||
create table t3(d int not null, e int, primary key(d)) engine = InnoDB
|
||||
select * from t2;
|
||||
commit;
|
||||
commit;
|
||||
drop table t1, t2, t3;
|
||||
create table t1(a int not null, b int, primary key(a)) engine=innodb;
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(a int not null, b int, primary key(a)) engine = InnoDB;
|
||||
insert into t1 values (1,2),(5,3),(4,2);
|
||||
create table t2(a int not null, b int, primary key(a)) engine=innodb;
|
||||
create table t2(a int not null, b int, primary key(a)) engine = InnoDB;
|
||||
insert into t2 values (8,6),(12,1),(3,1);
|
||||
create table t3(d int not null, b int, primary key(d)) engine=innodb;
|
||||
create table t3(d int not null, b int, primary key(d)) engine = InnoDB;
|
||||
insert into t3 values (8,6),(12,1),(3,1);
|
||||
create table t5(a int not null, b int, primary key(a)) engine=innodb;
|
||||
create table t5(a int not null, b int, primary key(a)) engine = InnoDB;
|
||||
insert into t5 values (1,2),(5,3),(4,2);
|
||||
create table t6(d int not null, e int, primary key(d)) engine=innodb;
|
||||
create table t6(d int not null, e int, primary key(d)) engine = InnoDB;
|
||||
insert into t6 values (8,6),(12,1),(3,1);
|
||||
create table t8(a int not null, b int, primary key(a)) engine=innodb;
|
||||
create table t8(a int not null, b int, primary key(a)) engine = InnoDB;
|
||||
insert into t8 values (1,2),(5,3),(4,2);
|
||||
create table t9(d int not null, e int, primary key(d)) engine=innodb;
|
||||
create table t9(d int not null, e int, primary key(d)) engine = InnoDB;
|
||||
insert into t9 values (8,6),(12,1),(3,1);
|
||||
commit;
|
||||
set autocommit = 0;
|
||||
|
@ -94,19 +97,19 @@ SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
|||
update t3 set b = (select b from t2 where a = d);
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2;
|
||||
create table t4(a int not null, b int, primary key(a)) select * from t2;
|
||||
set autocommit = 0;
|
||||
insert into t5 (select * from t2 lock in share mode);
|
||||
set autocommit = 0;
|
||||
update t6 set e = (select b from t2 where a = d lock in share mode);
|
||||
set autocommit = 0;
|
||||
create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode;
|
||||
create table t7(a int not null, b int, primary key(a)) select * from t2 lock in share mode;
|
||||
set autocommit = 0;
|
||||
insert into t8 (select * from t2 for update);
|
||||
set autocommit = 0;
|
||||
update t9 set e = (select b from t2 where a = d for update);
|
||||
set autocommit = 0;
|
||||
create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update;
|
||||
create table t10(a int not null, b int, primary key(a)) select * from t2 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
16
mysql-test/t/cache_innodb.test
Normal file
16
mysql-test/t/cache_innodb.test
Normal file
|
@ -0,0 +1,16 @@
|
|||
# t/cache_innodb.test
|
||||
#
|
||||
# Last update:
|
||||
# 2006-07-26 ML test refactored (MySQL 5.1)
|
||||
# main code t/innodb_cache.test --> include/query_cache.inc
|
||||
# new wrapper t/cache_innodb.test
|
||||
#
|
||||
|
||||
--source include/have_query_cache.inc
|
||||
|
||||
--source include/have_innodb.inc
|
||||
let $engine_type= InnoDB;
|
||||
# InnoDB supports FOREIGN KEYs
|
||||
let $test_foreign_keys= 1;
|
||||
|
||||
--source include/query_cache.inc
|
20
mysql-test/t/concurrent_innodb.test
Normal file
20
mysql-test/t/concurrent_innodb.test
Normal file
|
@ -0,0 +1,20 @@
|
|||
# t/concurrent_innodb.test
|
||||
#
|
||||
# Concurrent InnoDB tests, mainly in UPDATE's
|
||||
# Bug#3300
|
||||
# Designed and tested by Sinisa Milivojevic, sinisa@mysql.com
|
||||
#
|
||||
# two non-interfering UPDATE's not changing result set
|
||||
#
|
||||
# Last update:
|
||||
# 2006-07-26 ML test refactored (MySQL 5.1)
|
||||
# main code t/innodb_concurrent.test -> include/concurrent.inc
|
||||
# new wrapper t/concurrent_innodb.test
|
||||
|
||||
# test takes circa 5 minutes to run, so it's big
|
||||
--source include/big_test.inc
|
||||
|
||||
--source include/have_innodb.inc
|
||||
let $engine_type= InnoDB;
|
||||
|
||||
--source include/concurrent.inc
|
16
mysql-test/t/deadlock_innodb.test
Normal file
16
mysql-test/t/deadlock_innodb.test
Normal file
|
@ -0,0 +1,16 @@
|
|||
# t/deadlock_innodb.test
|
||||
#
|
||||
#
|
||||
# Last update:
|
||||
# 2006-07-26 ML test refactored (MySQL 5.1)
|
||||
# main code --> include/deadlock.inc
|
||||
# new wrapper t/deadlock_innodb.test
|
||||
#
|
||||
|
||||
# Can't test this with embedded server
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--source include/have_innodb.inc
|
||||
let $engine_type= InnoDB;
|
||||
|
||||
--source include/deadlock.inc
|
|
@ -16,6 +16,7 @@
|
|||
#im_instance_conf : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly
|
||||
im_options : Bug#20294 2006-07-24 stewart Instance manager test im_instance_conf fails randomly
|
||||
#im_life_cycle : Bug#20368 2006-06-10 alik im_life_cycle test fails
|
||||
concurrent_innodb : BUG#21579 2006-08-11 mleich innodb_concurrent random failures with varying differences
|
||||
ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
|
||||
ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
|
||||
ndb_binlog_ignore_db : BUG#21279 2006-07-25 ingo Randomly throws a warning
|
||||
|
|
18
mysql-test/t/handler_innodb.test
Normal file
18
mysql-test/t/handler_innodb.test
Normal file
|
@ -0,0 +1,18 @@
|
|||
# t/handler_innodb.test
|
||||
#
|
||||
# test of HANDLER ...
|
||||
#
|
||||
# Last update:
|
||||
# 2006-07-31 ML test refactored (MySQL 5.1)
|
||||
# code of t/handler.test and t/innodb_handler.test united
|
||||
# main testing code put into include/handler.inc
|
||||
# rename t/innodb_handler.test to t/handler_innodb.test
|
||||
#
|
||||
|
||||
# should work in embedded server after mysqltest is fixed
|
||||
--source include/not_embedded.inc
|
||||
|
||||
--source include/have_innodb.inc
|
||||
let $engine_type= InnoDB;
|
||||
|
||||
--source include/handler.inc
|
17
mysql-test/t/handler_myisam.test
Normal file
17
mysql-test/t/handler_myisam.test
Normal file
|
@ -0,0 +1,17 @@
|
|||
# t/handler_myisam.test
|
||||
#
|
||||
# test of HANDLER ...
|
||||
#
|
||||
# Last update:
|
||||
# 2006-07-31 ML test refactored (MySQL 5.1)
|
||||
# code of t/handler.test and t/innodb_handler.test united
|
||||
# main testing code put into include/handler.inc
|
||||
# rename t/handler.test to t/handler_myisam.test
|
||||
#
|
||||
|
||||
# should work in embedded server after mysqltest is fixed
|
||||
--source include/not_embedded.inc
|
||||
|
||||
let $engine_type= MyISAM;
|
||||
|
||||
--source include/handler.inc
|
|
@ -1,302 +1,24 @@
|
|||
# t/index_merge_innodb.test
|
||||
#
|
||||
# Index merge tests
|
||||
#
|
||||
-- source include/have_innodb.inc
|
||||
# Last update:
|
||||
# 2006-08-07 ML test refactored (MySQL 5.1)
|
||||
# Main code of several index_merge tests
|
||||
# -> include/index_merge*.inc
|
||||
# wrapper t/index_merge_innodb.test sources now several
|
||||
# include/index_merge*.inc files
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
create table t1
|
||||
(
|
||||
key1 int not null,
|
||||
key2 int not null,
|
||||
|
||||
INDEX i1(key1),
|
||||
INDEX i2(key2)
|
||||
) engine=innodb;
|
||||
|
||||
--disable_query_log
|
||||
let $1=200;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t1 values (200-$1, $1);
|
||||
dec $1;
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
# No primary key
|
||||
explain select * from t1 where key1 < 5 or key2 > 197;
|
||||
|
||||
select * from t1 where key1 < 5 or key2 > 197;
|
||||
|
||||
explain select * from t1 where key1 < 3 or key2 > 195;
|
||||
select * from t1 where key1 < 3 or key2 > 195;
|
||||
|
||||
# Primary key as case-sensitive string with \0s.
|
||||
# also make primary key be longer then max. index length of MyISAM.
|
||||
alter table t1 add str1 char (255) not null,
|
||||
add zeroval int not null default 0,
|
||||
add str2 char (255) not null,
|
||||
add str3 char (255) not null;
|
||||
|
||||
update t1 set str1='aaa', str2='bbb', str3=concat(key2, '-', key1 div 2, '_' ,if(key1 mod 2 = 0, 'a', 'A'));
|
||||
|
||||
alter table t1 add primary key (str1, zeroval, str2, str3);
|
||||
|
||||
explain select * from t1 where key1 < 5 or key2 > 197;
|
||||
|
||||
select * from t1 where key1 < 5 or key2 > 197;
|
||||
|
||||
explain select * from t1 where key1 < 3 or key2 > 195;
|
||||
select * from t1 where key1 < 3 or key2 > 195;
|
||||
|
||||
# Test for BUG#5401
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
pk integer not null auto_increment primary key,
|
||||
key1 integer,
|
||||
key2 integer not null,
|
||||
filler char (200),
|
||||
index (key1),
|
||||
index (key2)
|
||||
) engine=innodb;
|
||||
show warnings;
|
||||
--disable_query_log
|
||||
let $1=30;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t1 (key1, key2, filler) values ($1/4, $1/8, 'filler-data');
|
||||
dec $1;
|
||||
}
|
||||
--enable_query_log
|
||||
explain select pk from t1 where key1 = 1 and key2 = 1;
|
||||
select pk from t1 where key2 = 1 and key1 = 1;
|
||||
select pk from t1 ignore index(key1,key2) where key2 = 1 and key1 = 1;
|
||||
|
||||
# More tests for BUG#5401.
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
pk int primary key auto_increment,
|
||||
key1a int,
|
||||
key2a int,
|
||||
key1b int,
|
||||
key2b int,
|
||||
dummy1 int,
|
||||
dummy2 int,
|
||||
dummy3 int,
|
||||
dummy4 int,
|
||||
key3a int,
|
||||
key3b int,
|
||||
filler1 char (200),
|
||||
index i1(key1a, key1b),
|
||||
index i2(key2a, key2b),
|
||||
index i3(key3a, key3b)
|
||||
) engine=innodb;
|
||||
|
||||
create table t2 (a int);
|
||||
insert into t2 values (0),(1),(2),(3),(4),(NULL);
|
||||
|
||||
insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
|
||||
select A.a, B.a, C.a, D.a, C.a, D.a from t2 A,t2 B,t2 C, t2 D;
|
||||
insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
|
||||
select key1a, key1b, key2a, key2b, key3a, key3b from t1;
|
||||
insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
|
||||
select key1a, key1b, key2a, key2b, key3a, key3b from t1;
|
||||
analyze table t1;
|
||||
select count(*) from t1;
|
||||
|
||||
explain select count(*) from t1 where
|
||||
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
|
||||
|
||||
select count(*) from t1 where
|
||||
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
|
||||
|
||||
explain select count(*) from t1 where
|
||||
key1a = 2 and key1b is null and key3a = 2 and key3b is null;
|
||||
|
||||
select count(*) from t1 where
|
||||
key1a = 2 and key1b is null and key3a = 2 and key3b is null;
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
# Test for BUG#8441
|
||||
create table t1 (
|
||||
id1 int,
|
||||
id2 date ,
|
||||
index idx2 (id1,id2),
|
||||
index idx1 (id2)
|
||||
) engine = innodb;
|
||||
insert into t1 values(1,'20040101'), (2,'20040102');
|
||||
select * from t1 where id1 = 1 and id2= '20040101';
|
||||
drop table t1;
|
||||
|
||||
# Test for BUG#12720
|
||||
--disable_warnings
|
||||
drop view if exists v1;
|
||||
--enable_warnings
|
||||
CREATE TABLE t1 (
|
||||
`oid` int(11) unsigned NOT NULL auto_increment,
|
||||
`fk_bbk_niederlassung` int(11) unsigned NOT NULL,
|
||||
`fk_wochentag` int(11) unsigned NOT NULL,
|
||||
`uhrzeit_von` time NOT NULL COMMENT 'HH:MM',
|
||||
`uhrzeit_bis` time NOT NULL COMMENT 'HH:MM',
|
||||
`geloescht` tinyint(4) NOT NULL,
|
||||
`version` int(5) NOT NULL,
|
||||
PRIMARY KEY (`oid`),
|
||||
KEY `fk_bbk_niederlassung` (`fk_bbk_niederlassung`),
|
||||
KEY `fk_wochentag` (`fk_wochentag`),
|
||||
KEY `ix_version` (`version`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
insert into t1 values
|
||||
(1, 38, 1, '08:00:00', '13:00:00', 0, 1),
|
||||
(2, 38, 2, '08:00:00', '13:00:00', 0, 1),
|
||||
(3, 38, 3, '08:00:00', '13:00:00', 0, 1),
|
||||
(4, 38, 4, '08:00:00', '13:00:00', 0, 1),
|
||||
(5, 38, 5, '08:00:00', '13:00:00', 0, 1),
|
||||
(6, 38, 5, '08:00:00', '13:00:00', 1, 2),
|
||||
(7, 38, 3, '08:00:00', '13:00:00', 1, 2),
|
||||
(8, 38, 1, '08:00:00', '13:00:00', 1, 2),
|
||||
(9, 38, 2, '08:00:00', '13:00:00', 1, 2),
|
||||
(10, 38, 4, '08:00:00', '13:00:00', 1, 2),
|
||||
(11, 38, 1, '08:00:00', '13:00:00', 0, 3),
|
||||
(12, 38, 2, '08:00:00', '13:00:00', 0, 3),
|
||||
(13, 38, 3, '08:00:00', '13:00:00', 0, 3),
|
||||
(14, 38, 4, '08:00:00', '13:00:00', 0, 3),
|
||||
(15, 38, 5, '08:00:00', '13:00:00', 0, 3),
|
||||
(16, 38, 4, '08:00:00', '13:00:00', 0, 4),
|
||||
(17, 38, 5, '08:00:00', '13:00:00', 0, 4),
|
||||
(18, 38, 1, '08:00:00', '13:00:00', 0, 4),
|
||||
(19, 38, 2, '08:00:00', '13:00:00', 0, 4),
|
||||
(20, 38, 3, '08:00:00', '13:00:00', 0, 4),
|
||||
(21, 7, 1, '08:00:00', '13:00:00', 0, 1),
|
||||
(22, 7, 2, '08:00:00', '13:00:00', 0, 1),
|
||||
(23, 7, 3, '08:00:00', '13:00:00', 0, 1),
|
||||
(24, 7, 4, '08:00:00', '13:00:00', 0, 1),
|
||||
(25, 7, 5, '08:00:00', '13:00:00', 0, 1);
|
||||
|
||||
create view v1 as
|
||||
select
|
||||
zeit1.oid AS oid,
|
||||
zeit1.fk_bbk_niederlassung AS fk_bbk_niederlassung,
|
||||
zeit1.fk_wochentag AS fk_wochentag,
|
||||
zeit1.uhrzeit_von AS uhrzeit_von,
|
||||
zeit1.uhrzeit_bis AS uhrzeit_bis,
|
||||
zeit1.geloescht AS geloescht,
|
||||
zeit1.version AS version
|
||||
from
|
||||
t1 zeit1
|
||||
where
|
||||
(zeit1.version =
|
||||
(select max(zeit2.version) AS `max(version)`
|
||||
from t1 zeit2
|
||||
where
|
||||
((zeit1.fk_bbk_niederlassung = zeit2.fk_bbk_niederlassung) and
|
||||
(zeit1.fk_wochentag = zeit2.fk_wochentag) and
|
||||
(zeit1.uhrzeit_von = zeit2.uhrzeit_von) and
|
||||
(zeit1.uhrzeit_bis = zeit2.uhrzeit_bis)
|
||||
)
|
||||
)
|
||||
)
|
||||
and (zeit1.geloescht = 0);
|
||||
|
||||
select * from v1 where oid = 21;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
##
|
||||
CREATE TABLE t1(
|
||||
t_cpac varchar(2) NOT NULL,
|
||||
t_vers varchar(4) NOT NULL,
|
||||
t_rele varchar(2) NOT NULL,
|
||||
t_cust varchar(4) NOT NULL,
|
||||
filler1 char(250) default NULL,
|
||||
filler2 char(250) default NULL,
|
||||
PRIMARY KEY (t_cpac,t_vers,t_rele,t_cust),
|
||||
UNIQUE KEY IX_4 (t_cust,t_cpac,t_vers,t_rele),
|
||||
KEY IX_5 (t_vers,t_rele,t_cust)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
insert into t1 values
|
||||
('tm','2.5 ','a ',' ','',''), ('tm','2.5U','a ','stnd','',''),
|
||||
('da','3.3 ','b ',' ','',''), ('da','3.3U','b ','stnd','',''),
|
||||
('tl','7.6 ','a ',' ','',''), ('tt','7.6 ','a ',' ','',''),
|
||||
('bc','B61 ','a ',' ','',''), ('bp','B61 ','a ',' ','',''),
|
||||
('ca','B61 ','a ',' ','',''), ('ci','B61 ','a ',' ','',''),
|
||||
('cp','B61 ','a ',' ','',''), ('dm','B61 ','a ',' ','',''),
|
||||
('ec','B61 ','a ',' ','',''), ('ed','B61 ','a ',' ','',''),
|
||||
('fm','B61 ','a ',' ','',''), ('nt','B61 ','a ',' ','',''),
|
||||
('qm','B61 ','a ',' ','',''), ('tc','B61 ','a ',' ','',''),
|
||||
('td','B61 ','a ',' ','',''), ('tf','B61 ','a ',' ','',''),
|
||||
('tg','B61 ','a ',' ','',''), ('ti','B61 ','a ',' ','',''),
|
||||
('tp','B61 ','a ',' ','',''), ('ts','B61 ','a ',' ','',''),
|
||||
('wh','B61 ','a ',' ','',''), ('bc','B61U','a ','stnd','',''),
|
||||
('bp','B61U','a ','stnd','',''), ('ca','B61U','a ','stnd','',''),
|
||||
('ci','B61U','a ','stnd','',''), ('cp','B61U','a ','stnd','',''),
|
||||
('dm','B61U','a ','stnd','',''), ('ec','B61U','a ','stnd','',''),
|
||||
('fm','B61U','a ','stnd','',''), ('nt','B61U','a ','stnd','',''),
|
||||
('qm','B61U','a ','stnd','',''), ('tc','B61U','a ','stnd','',''),
|
||||
('td','B61U','a ','stnd','',''), ('tf','B61U','a ','stnd','',''),
|
||||
('tg','B61U','a ','stnd','',''), ('ti','B61U','a ','stnd','',''),
|
||||
('tp','B61U','a ','stnd','',''), ('ts','B61U','a ','stnd','',''),
|
||||
('wh','B61U','a ','stnd','','');
|
||||
show create table t1;
|
||||
|
||||
select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6';
|
||||
select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6'
|
||||
and t_rele='a' and t_cust = ' ';
|
||||
|
||||
drop table t1;
|
||||
|
||||
# BUG#19021: Crash in index_merge/ROR-intersection optimizer under
|
||||
# specific circumstances.
|
||||
create table t1 (
|
||||
pk int(11) not null auto_increment,
|
||||
a int(11) not null default '0',
|
||||
b int(11) not null default '0',
|
||||
c int(11) not null default '0',
|
||||
|
||||
filler1 datetime, filler2 varchar(15),
|
||||
filler3 longtext,
|
||||
|
||||
kp1 varchar(4), kp2 varchar(7),
|
||||
kp3 varchar(2), kp4 varchar(4),
|
||||
kp5 varchar(7),
|
||||
filler4 char(1),
|
||||
|
||||
primary key (pk),
|
||||
key idx1(a,b,c),
|
||||
key idx2(c),
|
||||
key idx3(kp1,kp2,kp3,kp4,kp5)
|
||||
) engine=innodb default charset=latin1;
|
||||
--disable_query_log
|
||||
set @fill= uncompress(unhex(concat(
|
||||
'F91D0000789CDD993D6FDB301086F7FE0A6D4E0105B8E3F1335D5BA028DA0EEDE28E1D320408',
|
||||
'52A0713BF4D7571FB62C51A475924839080307B603E77DEE787C8FA41F9E9EEF7F1F8A87A7C3',
|
||||
'AFE280C5DF9F8F7FEE9F8B1B2CB114D6902E918455245DB91300FA16E42D5201FA4EE29DA05D',
|
||||
'B9FB3718A33718A3FA8C30AEFAFDE1F317D016AA67BA7A60FDE45BF5F8BA7B5BDE8812AA9F1A',
|
||||
'069DB03C9804346644F3A3A6A1338DB572756A3C4D1BCC804CABF912C654AE9BB855A2B85962',
|
||||
'3A479259CAE6A86C0411D01AE5483581EDCBD9A39C45252D532E533979EB9F82E971D979BDB4',
|
||||
'8531105670740AFBFD1E34AAB0029E4AD0A1D46A6D0946A21A16038A5CD965CD2D524673F712',
|
||||
'20C304477315CE18405EAF9BD0AFFEAC74FDA14F1FBF5BD34C769D73FBBEDF4750ADD4E5A99C',
|
||||
'5C8DC04934AFA275D483D536D174C11B12AF27F8F888B41B6FC9DBA569E1FD7BD72D698130B7',
|
||||
'91B23A98803512B3D31881E8DCDA2AC1754E3644C4BB3A8466750B911681274A39E35E8624B7',
|
||||
'444A42AC1213F354758E3CF1A4CDD5A688C767CF1B11ABC5867CB15D8A18E0B91E9EC275BB94',
|
||||
'58F33C2936F64690D55BC29E4A293D95A798D84217736CEAAA538CE1354269EE2162053FBC66',
|
||||
'496D90CB53323CB279D3A6AF651B4B22B9E430743D83BE48E995A09D4FC9871C22D8D189B945',
|
||||
'706911BCB8C3C774B9C08D2FC6ED853ADACA37A14A4CB2E027630E5B80ECACD939431B1CDF62',
|
||||
'7D71487536EA2C678F59685E91F4B6C144BCCB94C1EBA9FA6F5552DDCA4E4539BE326A2720CB',
|
||||
'45ED028EB3616AC93C46E775FEA9FA6DA7CFCEC6DEBA5FCD1F915EED4D983BDDB881528AD9AB',
|
||||
'43C1576F29AAB35BDFBC21D422F52B307D350589D45225A887AC46C8EDD72D99EC3ED2E1BCEF',
|
||||
'7AF26FC4C74097B6768A5EDAFA660CC64278F7E63F99AC954B')));
|
||||
prepare x from @fill;
|
||||
execute x;
|
||||
deallocate prepare x;
|
||||
--enable_query_log
|
||||
set @fill=NULL;
|
||||
SELECT COUNT(*) FROM t1 WHERE b = 0 AND a = 0 AND c = 13286427 AND
|
||||
kp1='279' AND kp2='ELM0678' AND kp3='6' AND kp4='10' AND kp5 = 'R ';
|
||||
|
||||
drop table t1;
|
||||
--source include/have_innodb.inc
|
||||
let $engine_type= InnoDB;
|
||||
# InnoDB does not support Merge tables (affects include/index_merge1.inc)
|
||||
let $merge_table_support= 0;
|
||||
|
||||
# Tests disabled because of open Bug#21277 and non deterministic explain output.
|
||||
# --source include/index_merge1.inc
|
||||
# --source include/index_merge_ror.inc
|
||||
|
||||
--source include/index_merge2.inc
|
||||
--source include/index_merge_2sweeps.inc
|
||||
--source include/index_merge_ror_cpk.inc
|
||||
|
|
21
mysql-test/t/index_merge_myisam.test
Normal file
21
mysql-test/t/index_merge_myisam.test
Normal file
|
@ -0,0 +1,21 @@
|
|||
# t/index_merge_myisam.test
|
||||
#
|
||||
# Index merge tests
|
||||
#
|
||||
# Last update:
|
||||
# 2006-08-07 ML test refactored (MySQL 5.1)
|
||||
# Main code of several index_merge tests
|
||||
# -> include/index_merge*.inc
|
||||
# wrapper t/index_merge_innodb.test sources now several
|
||||
# include/index_merge*.inc files
|
||||
#
|
||||
|
||||
let $engine_type= MyISAM;
|
||||
# MyISAM supports Merge tables
|
||||
let $merge_table_support= 1;
|
||||
|
||||
--source include/index_merge1.inc
|
||||
--source include/index_merge_ror.inc
|
||||
--source include/index_merge2.inc
|
||||
--source include/index_merge_2sweeps.inc
|
||||
--source include/index_merge_ror_cpk.inc
|
|
@ -1,117 +0,0 @@
|
|||
-- source include/have_innodb.inc
|
||||
# Can't test this with embedded server
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
connect (con2,localhost,root,,);
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Testing of FOR UPDATE
|
||||
#
|
||||
|
||||
connection con1;
|
||||
create table t1 (id integer, x integer) engine=INNODB;
|
||||
insert into t1 values(0, 0);
|
||||
set autocommit=0;
|
||||
SELECT * from t1 where id = 0 FOR UPDATE;
|
||||
|
||||
connection con2;
|
||||
set autocommit=0;
|
||||
|
||||
# The following query should hang because con1 is locking the page
|
||||
--send
|
||||
update t1 set x=2 where id = 0;
|
||||
--sleep 2
|
||||
|
||||
connection con1;
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
connection con2;
|
||||
reap;
|
||||
commit;
|
||||
|
||||
connection con1;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
drop table t1;
|
||||
#
|
||||
# Testing of FOR UPDATE
|
||||
#
|
||||
|
||||
connection con1;
|
||||
create table t1 (id integer, x integer) engine=INNODB;
|
||||
create table t2 (b integer, a integer) engine=INNODB;
|
||||
insert into t1 values(0, 0), (300, 300);
|
||||
insert into t2 values(0, 10), (1, 20), (2, 30);
|
||||
commit;
|
||||
set autocommit=0;
|
||||
select * from t2;
|
||||
update t2 set a=100 where b=(SELECT x from t1 where id = b FOR UPDATE);
|
||||
select * from t2;
|
||||
select * from t1;
|
||||
|
||||
connection con2;
|
||||
set autocommit=0;
|
||||
|
||||
# The following query should hang because con1 is locking the page
|
||||
--send
|
||||
update t1 set x=2 where id = 0;
|
||||
--sleep 2
|
||||
|
||||
connection con1;
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
connection con2;
|
||||
reap;
|
||||
commit;
|
||||
|
||||
connection con1;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
drop table t1, t2;
|
||||
create table t1 (id integer, x integer) engine=INNODB;
|
||||
create table t2 (b integer, a integer) engine=INNODB;
|
||||
insert into t1 values(0, 0), (300, 300);
|
||||
insert into t2 values(0, 0), (1, 20), (2, 30);
|
||||
commit;
|
||||
|
||||
connection con1;
|
||||
select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE;
|
||||
select * from t2;
|
||||
select * from t1;
|
||||
|
||||
connection con2;
|
||||
|
||||
# The following query should hang because con1 is locking the page
|
||||
update t2 set a=2 where b = 0;
|
||||
select * from t2;
|
||||
--send
|
||||
update t1 set x=2 where id = 0;
|
||||
--sleep 2
|
||||
|
||||
connection con1;
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
connection con2;
|
||||
reap;
|
||||
commit;
|
||||
|
||||
connection con1;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
# End of 4.1 tests
|
|
@ -1,96 +0,0 @@
|
|||
-- source include/have_innodb.inc
|
||||
|
||||
#
|
||||
# test of HANDLER ...
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (a int, b char(10), key a(a), key b(a,b)) engine=innodb;
|
||||
insert into t1 values
|
||||
(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
|
||||
(14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"),
|
||||
(20,"ggg"),(21,"hhh"),(22,"iii");
|
||||
handler t1 open as t2;
|
||||
handler t2 read a first;
|
||||
handler t2 read a next;
|
||||
handler t2 read a next;
|
||||
handler t2 read a prev;
|
||||
handler t2 read a last;
|
||||
handler t2 read a prev;
|
||||
handler t2 read a prev;
|
||||
|
||||
handler t2 read a first;
|
||||
handler t2 read a prev;
|
||||
|
||||
handler t2 read a last;
|
||||
handler t2 read a prev;
|
||||
handler t2 read a next;
|
||||
handler t2 read a next;
|
||||
|
||||
handler t2 read a=(15);
|
||||
handler t2 read a=(16);
|
||||
|
||||
--error 1070
|
||||
handler t2 read a=(19,"fff");
|
||||
|
||||
handler t2 read b=(19,"fff");
|
||||
handler t2 read b=(19,"yyy");
|
||||
handler t2 read b=(19);
|
||||
|
||||
--error 1109
|
||||
handler t1 read a last;
|
||||
|
||||
handler t2 read a=(11);
|
||||
handler t2 read a>=(11);
|
||||
|
||||
handler t2 read a=(18);
|
||||
handler t2 read a>=(18);
|
||||
handler t2 read a>(18);
|
||||
handler t2 read a<=(18);
|
||||
handler t2 read a<(18);
|
||||
|
||||
handler t2 read a first limit 5;
|
||||
handler t2 read a next limit 3;
|
||||
handler t2 read a prev limit 10;
|
||||
|
||||
handler t2 read a>=(16) limit 4;
|
||||
handler t2 read a>=(16) limit 2,2;
|
||||
handler t2 read a last limit 3;
|
||||
|
||||
handler t2 read a=(19);
|
||||
handler t2 read a=(19) where b="yyy";
|
||||
|
||||
handler t2 read first;
|
||||
handler t2 read next;
|
||||
--error 1064
|
||||
handler t2 read last;
|
||||
handler t2 close;
|
||||
|
||||
handler t1 open;
|
||||
handler t1 read a next; # this used to crash as a bug#5373
|
||||
handler t1 read a next;
|
||||
handler t1 close;
|
||||
|
||||
handler t1 open;
|
||||
handler t1 read a prev; # this used to crash as a bug#5373
|
||||
handler t1 read a prev;
|
||||
handler t1 close;
|
||||
|
||||
handler t1 open as t2;
|
||||
handler t2 read first;
|
||||
alter table t1 engine=innodb;
|
||||
--error 1109
|
||||
handler t2 read first;
|
||||
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2);
|
||||
HANDLER t1 OPEN;
|
||||
HANDLER t1 READ `primary` = (1, 1000);
|
||||
HANDLER t1 READ `primary` PREV;
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
|
@ -1,322 +1,12 @@
|
|||
# t/innodb_mysql.test
|
||||
#
|
||||
# Last update:
|
||||
# 2006-07-26 ML test refactored (MySQL 5.1)
|
||||
# main testing code t/innodb_mysql.test -> include/mix1.inc
|
||||
#
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
let $engine_type= InnoDB;
|
||||
let $other_engine_type= MEMORY;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t1m,t1i,t2m,t2i,t4;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Bug#17530: Incorrect key truncation on table creation caused server crash.
|
||||
#
|
||||
create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
|
||||
character set utf8 collate utf8_general_ci;
|
||||
insert into t1 values('aaa');
|
||||
drop table t1;
|
||||
|
||||
# BUG#16798: Uninitialized row buffer reads in ref-or-null optimizer
|
||||
# (repeatable only w/innodb).
|
||||
create table t1 (
|
||||
c_id int(11) not null default '0',
|
||||
org_id int(11) default null,
|
||||
unique key contacts$c_id (c_id),
|
||||
key contacts$org_id (org_id)
|
||||
) engine=innodb;
|
||||
insert into t1 values
|
||||
(2,null),(120,null),(141,null),(218,7), (128,1),
|
||||
(151,2),(234,2),(236,2),(243,2),(255,2),(259,2),(232,3),(235,3),(238,3),
|
||||
(246,3),(253,3),(269,3),(285,3),(291,3),(293,3),(131,4),(230,4),(231,4);
|
||||
|
||||
create table t2 (
|
||||
slai_id int(11) not null default '0',
|
||||
owner_tbl int(11) default null,
|
||||
owner_id int(11) default null,
|
||||
sla_id int(11) default null,
|
||||
inc_web int(11) default null,
|
||||
inc_email int(11) default null,
|
||||
inc_chat int(11) default null,
|
||||
inc_csr int(11) default null,
|
||||
inc_total int(11) default null,
|
||||
time_billed int(11) default null,
|
||||
activedate timestamp null default null,
|
||||
expiredate timestamp null default null,
|
||||
state int(11) default null,
|
||||
sla_set int(11) default null,
|
||||
unique key t2$slai_id (slai_id),
|
||||
key t2$owner_id (owner_id),
|
||||
key t2$sla_id (sla_id)
|
||||
) engine=innodb;
|
||||
insert into t2(slai_id, owner_tbl, owner_id, sla_id) values
|
||||
(1,3,1,1), (3,3,10,2), (4,3,3,6), (5,3,2,5), (6,3,8,3), (7,3,9,7),
|
||||
(8,3,6,8), (9,3,4,9), (10,3,5,10), (11,3,11,11), (12,3,7,12);
|
||||
|
||||
flush tables;
|
||||
select si.slai_id
|
||||
from t1 c join t2 si on
|
||||
((si.owner_tbl = 3 and si.owner_id = c.org_id) or
|
||||
( si.owner_tbl = 2 and si.owner_id = c.c_id))
|
||||
where
|
||||
c.c_id = 218 and expiredate is null;
|
||||
|
||||
select * from t1 where org_id is null;
|
||||
select si.slai_id
|
||||
from t1 c join t2 si on
|
||||
((si.owner_tbl = 3 and si.owner_id = c.org_id) or
|
||||
( si.owner_tbl = 2 and si.owner_id = c.c_id))
|
||||
where
|
||||
c.c_id = 218 and expiredate is null;
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Bug#17212: results not sorted correctly by ORDER BY when using index
|
||||
# (repeatable only w/innodb because of index props)
|
||||
#
|
||||
CREATE TABLE t1 (a int, b int, KEY b (b)) Engine=InnoDB;
|
||||
CREATE TABLE t2 (a int, b int, PRIMARY KEY (a,b)) Engine=InnoDB;
|
||||
CREATE TABLE t3 (a int, b int, c int, PRIMARY KEY (a),
|
||||
UNIQUE KEY b (b,c), KEY a (a,b,c)) Engine=InnoDB;
|
||||
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
INSERT INTO t1 SELECT a + 1, b + 1 FROM t1;
|
||||
INSERT INTO t1 SELECT a + 2, b + 2 FROM t1;
|
||||
|
||||
INSERT INTO t2 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8);
|
||||
INSERT INTO t2 SELECT a + 1, b FROM t2;
|
||||
DELETE FROM t2 WHERE a = 1 AND b < 2;
|
||||
|
||||
INSERT INTO t3 VALUES (1,1,1),(2,1,2);
|
||||
INSERT INTO t3 SELECT a + 2, a + 2, 3 FROM t3;
|
||||
INSERT INTO t3 SELECT a + 4, a + 4, 3 FROM t3;
|
||||
|
||||
# demonstrate a problem when a must-use-sort table flag
|
||||
# (sort_by_table=1) is being neglected.
|
||||
SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
|
||||
t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
|
||||
ORDER BY t1.b LIMIT 2;
|
||||
|
||||
# demonstrate the problem described in the bug report
|
||||
SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
|
||||
t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
|
||||
ORDER BY t1.b LIMIT 5;
|
||||
DROP TABLE t1, t2, t3;
|
||||
#
|
||||
# Bug #12882 min/max inconsistent on empty table
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
create table t1m (a int) engine=myisam;
|
||||
create table t1i (a int) engine=innodb;
|
||||
create table t2m (a int) engine=myisam;
|
||||
create table t2i (a int) engine=innodb;
|
||||
--enable_warnings
|
||||
insert into t2m values (5);
|
||||
insert into t2i values (5);
|
||||
|
||||
# test with MyISAM
|
||||
select min(a) from t1m;
|
||||
select min(7) from t1m;
|
||||
select min(7) from DUAL;
|
||||
explain select min(7) from t2m join t1m;
|
||||
select min(7) from t2m join t1m;
|
||||
|
||||
select max(a) from t1m;
|
||||
select max(7) from t1m;
|
||||
select max(7) from DUAL;
|
||||
explain select max(7) from t2m join t1m;
|
||||
select max(7) from t2m join t1m;
|
||||
|
||||
select 1, min(a) from t1m where a=99;
|
||||
select 1, min(a) from t1m where 1=99;
|
||||
select 1, min(1) from t1m where a=99;
|
||||
select 1, min(1) from t1m where 1=99;
|
||||
|
||||
select 1, max(a) from t1m where a=99;
|
||||
select 1, max(a) from t1m where 1=99;
|
||||
select 1, max(1) from t1m where a=99;
|
||||
select 1, max(1) from t1m where 1=99;
|
||||
|
||||
# test with InnoDB
|
||||
select min(a) from t1i;
|
||||
select min(7) from t1i;
|
||||
select min(7) from DUAL;
|
||||
explain select min(7) from t2i join t1i;
|
||||
select min(7) from t2i join t1i;
|
||||
|
||||
select max(a) from t1i;
|
||||
select max(7) from t1i;
|
||||
select max(7) from DUAL;
|
||||
explain select max(7) from t2i join t1i;
|
||||
select max(7) from t2i join t1i;
|
||||
|
||||
select 1, min(a) from t1i where a=99;
|
||||
select 1, min(a) from t1i where 1=99;
|
||||
select 1, min(1) from t1i where a=99;
|
||||
select 1, min(1) from t1i where 1=99;
|
||||
|
||||
select 1, max(a) from t1i where a=99;
|
||||
select 1, max(a) from t1i where 1=99;
|
||||
select 1, max(1) from t1i where a=99;
|
||||
select 1, max(1) from t1i where 1=99;
|
||||
|
||||
# mixed MyISAM/InnoDB test
|
||||
explain select count(*), min(7), max(7) from t1m, t1i;
|
||||
select count(*), min(7), max(7) from t1m, t1i;
|
||||
|
||||
explain select count(*), min(7), max(7) from t1m, t2i;
|
||||
select count(*), min(7), max(7) from t1m, t2i;
|
||||
|
||||
explain select count(*), min(7), max(7) from t2m, t1i;
|
||||
select count(*), min(7), max(7) from t2m, t1i;
|
||||
|
||||
drop table t1m, t1i, t2m, t2i;
|
||||
|
||||
#
|
||||
# Bug #12672: primary key implcitly included in every innodb index
|
||||
# (was part of group_min_max.test)
|
||||
#
|
||||
|
||||
create table t1 (
|
||||
a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
|
||||
);
|
||||
|
||||
insert into t1 (a1, a2, b, c, d) values
|
||||
('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
|
||||
('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
|
||||
('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
|
||||
('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
|
||||
('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
|
||||
('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
|
||||
('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
|
||||
('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
|
||||
('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
|
||||
('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
|
||||
('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
|
||||
('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
|
||||
('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
|
||||
('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
|
||||
('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
|
||||
('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'),
|
||||
('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
|
||||
('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
|
||||
('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
|
||||
('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
|
||||
('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
|
||||
('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
|
||||
('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
|
||||
('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
|
||||
('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
|
||||
('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
|
||||
('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
|
||||
('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
|
||||
('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
|
||||
('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
|
||||
('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
|
||||
('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
|
||||
--disable_warnings
|
||||
create table t4 (
|
||||
pk_col int auto_increment primary key, a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
|
||||
) engine=innodb;
|
||||
--enable_warnings
|
||||
insert into t4 (a1, a2, b, c, d, dummy) select * from t1;
|
||||
|
||||
create index idx12672_0 on t4 (a1);
|
||||
create index idx12672_1 on t4 (a1,a2,b,c);
|
||||
create index idx12672_2 on t4 (a1,a2,b);
|
||||
analyze table t1;
|
||||
|
||||
select distinct a1 from t4 where pk_col not in (1,2,3,4);
|
||||
|
||||
drop table t1,t4;
|
||||
|
||||
#
|
||||
# Bug #6142: a problem with the empty innodb table
|
||||
# (was part of group_min_max.test)
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
create table t1 (
|
||||
a varchar(30), b varchar(30), primary key(a), key(b)
|
||||
) engine=innodb;
|
||||
--enable_warnings
|
||||
select distinct a from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #9798: group by with rollup
|
||||
# (was part of group_min_max.test)
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
create table t1(a int, key(a)) engine=innodb;
|
||||
--enable_warnings
|
||||
insert into t1 values(1);
|
||||
select a, count(a) from t1 group by a with rollup;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #13293 Wrongly used index results in endless loop.
|
||||
# (was part of group_min_max.test)
|
||||
#
|
||||
create table t1 (f1 int, f2 char(1), primary key(f1,f2)) engine=innodb;
|
||||
insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d");
|
||||
alter table t1 drop primary key, add primary key (f2, f1);
|
||||
explain select distinct f1 a, f1 b from t1;
|
||||
explain select distinct f1, f2 from t1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Test of behaviour with CREATE ... SELECT
|
||||
#
|
||||
|
||||
set storage_engine=innodb;
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
insert into t1 values (1,1),(1,2);
|
||||
--error 1062
|
||||
CREATE TABLE t2 (primary key (a)) select * from t1;
|
||||
# This should give warning
|
||||
drop table if exists t2;
|
||||
--error 1062
|
||||
CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1;
|
||||
# This should give warning
|
||||
drop table if exists t2;
|
||||
CREATE TABLE t2 (a int, b int, primary key (a));
|
||||
BEGIN;
|
||||
INSERT INTO t2 values(100,100);
|
||||
--error 1062
|
||||
CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
|
||||
SELECT * from t2;
|
||||
ROLLBACK;
|
||||
SELECT * from t2;
|
||||
TRUNCATE table t2;
|
||||
--error 1062
|
||||
INSERT INTO t2 select * from t1;
|
||||
SELECT * from t2;
|
||||
drop table t2;
|
||||
|
||||
CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a));
|
||||
BEGIN;
|
||||
INSERT INTO t2 values(100,100);
|
||||
--error 1062
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
|
||||
SELECT * from t2;
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO t2 values(101,101);
|
||||
--error 1062
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
|
||||
SELECT * from t2;
|
||||
ROLLBACK;
|
||||
SELECT * from t2;
|
||||
TRUNCATE table t2;
|
||||
--error 1062
|
||||
INSERT INTO t2 select * from t1;
|
||||
SELECT * from t2;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Bug#17530: Incorrect key truncation on table creation caused server crash.
|
||||
#
|
||||
create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
|
||||
character set utf8 collate utf8_general_ci;
|
||||
insert into t1 values('aaa');
|
||||
drop table t1;
|
||||
--source include/mix1.inc
|
||||
|
|
19
mysql-test/t/mix2_myisam.test
Normal file
19
mysql-test/t/mix2_myisam.test
Normal file
|
@ -0,0 +1,19 @@
|
|||
# t/mix2_myisam.test
|
||||
#
|
||||
# Last update: 2006-07-26 ML create this test as derivate from innodb.test
|
||||
#
|
||||
|
||||
let $engine_type= MyISAM;
|
||||
let $other_engine_type= MEMORY;
|
||||
# MyISAM does not support transactions
|
||||
let $test_transactions= 0;
|
||||
# MyISAM does not support FOREIGN KEYFOREIGN KEYs
|
||||
let $test_foreign_keys= 0;
|
||||
# MyISAM supports fulltext queries
|
||||
let $fulltext_query_unsupported= 0;
|
||||
# MyISAM internal autoincrement values are updated during updates
|
||||
let $no_autoinc_update= 0;
|
||||
# MyISAM supports keys on spatial data types
|
||||
let $no_spatial_key= 0;
|
||||
|
||||
-- source include/mix2.inc
|
16
mysql-test/t/read_many_rows_innodb.test
Normal file
16
mysql-test/t/read_many_rows_innodb.test
Normal file
|
@ -0,0 +1,16 @@
|
|||
# t/read_many_rows_innodb.test
|
||||
#
|
||||
# Check how filesort and buffered-record-reads works with InnoDB.
|
||||
# This test takes a long time.
|
||||
#
|
||||
# Last update:
|
||||
# 2006-08-03 ML test refactored (MySQL 5.1)
|
||||
# main code --> include/read_many_rows_innodb.inc
|
||||
#
|
||||
|
||||
--source include/big_test.inc
|
||||
|
||||
--source include/have_innodb.inc
|
||||
let $engine_type= InnoDB;
|
||||
|
||||
--source include/read_many_rows.inc
|
|
@ -1,108 +1,14 @@
|
|||
# t/rowid_order_innodb.test
|
||||
#
|
||||
# Test for rowid ordering (and comparison) functions.
|
||||
# do index_merge select for tables with PK of various types.
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2, t3,t4;
|
||||
--enable_warnings
|
||||
# Last update:
|
||||
# 2006-07-28 ML test refactored (MySQL 5.1)
|
||||
# main code t/rowid_order_innodb.test -> include/rowid_order.inc
|
||||
#
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
# Signed number as rowid
|
||||
create table t1 (
|
||||
pk1 int not NULL,
|
||||
key1 int(11),
|
||||
key2 int(11),
|
||||
PRIMARY KEY (pk1),
|
||||
KEY key1 (key1),
|
||||
KEY key2 (key2)
|
||||
) engine=innodb;
|
||||
insert into t1 values (-5, 1, 1),
|
||||
(-100, 1, 1),
|
||||
(3, 1, 1),
|
||||
(0, 1, 1),
|
||||
(10, 1, 1);
|
||||
explain select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
|
||||
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
|
||||
drop table t1;
|
||||
|
||||
# Unsigned numbers as rowids
|
||||
create table t1 (
|
||||
pk1 int unsigned not NULL,
|
||||
key1 int(11),
|
||||
key2 int(11),
|
||||
PRIMARY KEY (pk1),
|
||||
KEY key1 (key1),
|
||||
KEY key2 (key2)
|
||||
) engine=innodb;
|
||||
insert into t1 values (0, 1, 1),
|
||||
(0xFFFFFFFF, 1, 1),
|
||||
(0xFFFFFFFE, 1, 1),
|
||||
(1, 1, 1),
|
||||
(2, 1, 1);
|
||||
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
|
||||
drop table t1;
|
||||
|
||||
# Case-insensitive char(N)
|
||||
create table t1 (
|
||||
pk1 char(4) not NULL,
|
||||
key1 int(11),
|
||||
key2 int(11),
|
||||
PRIMARY KEY (pk1),
|
||||
KEY key1 (key1),
|
||||
KEY key2 (key2)
|
||||
) engine=innodb collate latin2_general_ci;
|
||||
insert into t1 values ('a1', 1, 1),
|
||||
('b2', 1, 1),
|
||||
('A3', 1, 1),
|
||||
('B4', 1, 1);
|
||||
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
|
||||
drop table t1;
|
||||
|
||||
# Multi-part PK
|
||||
create table t1 (
|
||||
pk1 int not NULL,
|
||||
pk2 char(4) not NULL collate latin1_german1_ci,
|
||||
pk3 char(4) not NULL collate latin1_bin,
|
||||
key1 int(11),
|
||||
key2 int(11),
|
||||
PRIMARY KEY (pk1,pk2,pk3),
|
||||
KEY key1 (key1),
|
||||
KEY key2 (key2)
|
||||
) engine=innodb;
|
||||
insert into t1 values
|
||||
(1, 'u', 'u', 1, 1),
|
||||
(1, 'u', char(0xEC), 1, 1),
|
||||
(1, 'u', 'x', 1, 1);
|
||||
insert ignore into t1 select pk1, char(0xEC), pk3, key1, key2 from t1;
|
||||
insert ignore into t1 select pk1, 'x', pk3, key1, key2 from t1 where pk2='u';
|
||||
insert ignore into t1 select 2, pk2, pk3, key1, key2 from t1;
|
||||
select * from t1;
|
||||
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
|
||||
|
||||
# Hidden PK
|
||||
alter table t1 drop primary key;
|
||||
select * from t1;
|
||||
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
|
||||
drop table t1;
|
||||
|
||||
# Variable-length PK
|
||||
# this is also test for Bug#2688
|
||||
create table t1 (
|
||||
pk1 varchar(8) NOT NULL default '',
|
||||
pk2 varchar(4) NOT NULL default '',
|
||||
key1 int(11),
|
||||
key2 int(11),
|
||||
primary key(pk1, pk2),
|
||||
KEY key1 (key1),
|
||||
KEY key2 (key2)
|
||||
) engine=innodb;
|
||||
insert into t1 values ('','empt',2,2),
|
||||
('a','a--a',2,2),
|
||||
('bb','b--b',2,2),
|
||||
('ccc','c--c',2,2),
|
||||
('dddd','d--d',2,2);
|
||||
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
|
||||
|
||||
drop table t1;
|
||||
--source include/have_innodb.inc
|
||||
let $engine_type= InnoDB;
|
||||
|
||||
--source include/rowid_order.inc
|
||||
|
|
16
mysql-test/t/unsafe_binlog_innodb.test
Normal file
16
mysql-test/t/unsafe_binlog_innodb.test
Normal file
|
@ -0,0 +1,16 @@
|
|||
# t/unsafe_binlog_innodb.test
|
||||
#
|
||||
# Note that this test uses at least in case of InnoDB options
|
||||
# innodb_locks_unsafe_for_binlog = true
|
||||
# innodb_lock_timeout = 5
|
||||
#
|
||||
# Last update:
|
||||
# 2006-08-02 ML test refactored
|
||||
# old name was innodb_unsafe_binlog.test
|
||||
# main code went into include/unsafe_binlog.inc
|
||||
#
|
||||
|
||||
--source include/have_innodb.inc
|
||||
let $engine_type= InnoDB;
|
||||
|
||||
--source include/unsafe_binlog.inc
|
Loading…
Add table
Reference in a new issue