2006-08-16 14:58:49 +02:00
|
|
|
# t/index_merge_innodb.test
|
2003-11-20 21:27:11 +01:00
|
|
|
#
|
|
|
|
# Index merge tests
|
|
|
|
#
|
2006-08-16 14:58:49 +02:00
|
|
|
# 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
|
|
|
|
#
|
2006-04-13 14:05:32 +02:00
|
|
|
|
Added option --staging-run to mysql-test-run to mark slow, not important tests, to not be run in staging trees
Use MY_MUTEX_INIT_FAST for pool mutex
mysql-test/mysql-test-run.pl:
Added option --staging-run
Added information about --parallell=# to help message
mysql-test/suite/federated/federated_server.test:
Slow test, don't run with --staging-run
mysql-test/suite/maria/t/maria-preload.test:
Slow test, don't run with --staging-run
mysql-test/suite/rpl/t/rpl_optimize.test:
Slow test, don't run with --staging-run
mysql-test/suite/rpl/t/rpl_relayrotate.test:
Slow test, don't run with --staging-run
mysql-test/suite/rpl/t/rpl_row_001.test:
Slow test, don't run with --staging-run
mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test:
Slow test, don't run with --staging-run
mysql-test/suite/rpl/t/rpl_row_sp003.test:
Slow test, don't run with --staging-run
mysql-test/suite/rpl/t/rpl_start_stop_slave.test:
Slow test, don't run with --staging-run
mysql-test/t/compress.test:
Slow test, don't run with --staging-run
mysql-test/t/count_distinct3.test:
Slow test, don't run with --staging-run
mysql-test/t/index_merge_innodb.test:
Slow test, don't run with --staging-run
mysql-test/t/information_schema_all_engines.test:
Slow test, don't run with --staging-run
mysql-test/t/innodb_mysql.test:
Slow test, don't run with --staging-run
mysql-test/t/pool_of_threads.test:
Slow test, don't run with --staging-run
mysql-test/t/preload.test:
Slow test, don't run with --staging-run
mysql-test/t/ssl.test:
Slow test, don't run with --staging-run
mysql-test/t/ssl_compress.test:
Slow test, don't run with --staging-run
mysql-test/valgrind.supp:
Suppress warnings from SuSE 11.1 on x86
sql/scheduler.cc:
Use MY_MUTEX_INIT_FAST for pool mutex
2009-06-05 17:35:22 +02:00
|
|
|
# Slow test, don't run during staging part
|
|
|
|
--source include/not_staging.inc
|
2012-02-07 16:22:36 +01:00
|
|
|
--source include/have_xtradb.inc
|
Added option --staging-run to mysql-test-run to mark slow, not important tests, to not be run in staging trees
Use MY_MUTEX_INIT_FAST for pool mutex
mysql-test/mysql-test-run.pl:
Added option --staging-run
Added information about --parallell=# to help message
mysql-test/suite/federated/federated_server.test:
Slow test, don't run with --staging-run
mysql-test/suite/maria/t/maria-preload.test:
Slow test, don't run with --staging-run
mysql-test/suite/rpl/t/rpl_optimize.test:
Slow test, don't run with --staging-run
mysql-test/suite/rpl/t/rpl_relayrotate.test:
Slow test, don't run with --staging-run
mysql-test/suite/rpl/t/rpl_row_001.test:
Slow test, don't run with --staging-run
mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test:
Slow test, don't run with --staging-run
mysql-test/suite/rpl/t/rpl_row_sp003.test:
Slow test, don't run with --staging-run
mysql-test/suite/rpl/t/rpl_start_stop_slave.test:
Slow test, don't run with --staging-run
mysql-test/t/compress.test:
Slow test, don't run with --staging-run
mysql-test/t/count_distinct3.test:
Slow test, don't run with --staging-run
mysql-test/t/index_merge_innodb.test:
Slow test, don't run with --staging-run
mysql-test/t/information_schema_all_engines.test:
Slow test, don't run with --staging-run
mysql-test/t/innodb_mysql.test:
Slow test, don't run with --staging-run
mysql-test/t/pool_of_threads.test:
Slow test, don't run with --staging-run
mysql-test/t/preload.test:
Slow test, don't run with --staging-run
mysql-test/t/ssl.test:
Slow test, don't run with --staging-run
mysql-test/t/ssl_compress.test:
Slow test, don't run with --staging-run
mysql-test/valgrind.supp:
Suppress warnings from SuSE 11.1 on x86
sql/scheduler.cc:
Use MY_MUTEX_INIT_FAST for pool mutex
2009-06-05 17:35:22 +02:00
|
|
|
|
2006-08-16 14:58:49 +02:00
|
|
|
let $engine_type= InnoDB;
|
|
|
|
# InnoDB does not support Merge tables (affects include/index_merge1.inc)
|
|
|
|
let $merge_table_support= 0;
|
2006-04-13 14:05:32 +02:00
|
|
|
|
2010-12-02 08:39:39 +01:00
|
|
|
set @optimizer_switch_save= @@optimizer_switch;
|
|
|
|
set optimizer_switch='index_merge_sort_intersection=off';
|
|
|
|
|
2006-09-18 16:55:56 +02:00
|
|
|
# The first two tests are disabled because of non deterministic explain output.
|
|
|
|
# If include/index_merge1.inc can be enabled for InnoDB and all other
|
|
|
|
# storage engines, please remove the subtest for Bug#21277 from
|
|
|
|
# include/index_merge2.inc.
|
|
|
|
# This test exists already in include/index_merge1.inc.
|
2006-08-16 14:58:49 +02:00
|
|
|
# --source include/index_merge1.inc
|
|
|
|
# --source include/index_merge_ror.inc
|
2011-10-19 21:45:18 +02:00
|
|
|
#the next one is disabled in MySQL too: Bug#45727
|
2006-08-16 14:58:49 +02:00
|
|
|
--source include/index_merge2.inc
|
2006-04-13 14:05:32 +02:00
|
|
|
|
2006-08-16 14:58:49 +02:00
|
|
|
--source include/index_merge_2sweeps.inc
|
|
|
|
--source include/index_merge_ror_cpk.inc
|
2010-09-20 03:46:39 +02:00
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # BUG#56862/640419: Wrong result with sort_union index merge when one
|
|
|
|
--echo # of the merged index scans is the primary key scan
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
CREATE TABLE t1 (
|
|
|
|
pk int NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
a int,
|
|
|
|
b int,
|
|
|
|
INDEX idx(a))
|
|
|
|
ENGINE=INNODB;
|
|
|
|
|
|
|
|
INSERT INTO t1(a,b) VALUES
|
|
|
|
(11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500),
|
|
|
|
(3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800),
|
|
|
|
(6, 600), (18, 1800), (9, 900), (10, 1000), (7, 700),
|
|
|
|
(13, 1300), (15, 1500), (19, 1900), (16, 1600), (20, 2000);
|
|
|
|
INSERT INTO t1(a,b) SELECT a+20, b+2000 FROM t1;
|
|
|
|
INSERT INTO t1(a,b) SELECT a+40, b+4000 FROM t1;
|
|
|
|
INSERT INTO t1(a,b) SELECT a+80, b+8000 FROM t1;
|
|
|
|
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
|
|
|
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
|
|
|
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
|
|
|
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
|
|
|
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
|
|
|
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
|
|
|
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
|
|
|
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
|
|
|
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
|
|
|
INSERT INTO t1(a,b) SELECT a,b FROM t1;
|
|
|
|
INSERT INTO t1 VALUES (1000000, 0, 0);
|
|
|
|
|
|
|
|
SET SESSION sort_buffer_size = 1024*36;
|
2011-11-26 23:23:00 +01:00
|
|
|
set @tmp_optimizer_switch=@@optimizer_switch;
|
|
|
|
set optimizer_switch='derived_merge=off,derived_with_keys=off';
|
2010-09-20 03:46:39 +02:00
|
|
|
|
2010-12-06 10:25:04 +01:00
|
|
|
# We have to use FORCE INDEX here as Innodb gives inconsistent estimates
|
|
|
|
# which causes different query plans.
|
2010-09-20 03:46:39 +02:00
|
|
|
EXPLAIN
|
|
|
|
SELECT COUNT(*) FROM
|
2010-12-06 10:25:04 +01:00
|
|
|
(SELECT * FROM t1 FORCE INDEX(primary,idx)
|
2010-09-20 03:46:39 +02:00
|
|
|
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
|
|
|
SELECT COUNT(*) FROM
|
2010-12-07 23:48:04 +01:00
|
|
|
(SELECT * FROM t1 FORCE INDEX(primary,idx)
|
2010-09-20 03:46:39 +02:00
|
|
|
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
|
|
|
|
|
|
|
--replace_column 9 #
|
|
|
|
EXPLAIN
|
|
|
|
SELECT COUNT(*) FROM
|
|
|
|
(SELECT * FROM t1 IGNORE INDEX(idx)
|
|
|
|
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
|
|
|
SELECT COUNT(*) FROM
|
|
|
|
(SELECT * FROM t1 IGNORE INDEX(idx)
|
|
|
|
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
2011-11-26 23:23:00 +01:00
|
|
|
set optimizer_switch=@tmp_optimizer_switch;
|
2010-12-02 08:39:39 +01:00
|
|
|
|
2011-01-13 22:15:44 +01:00
|
|
|
--echo #
|
|
|
|
--echo # Testcase Backport: BUG#48093: 6.0 Server not processing equivalent IN clauses properly
|
|
|
|
--echo # with Innodb tables
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
CREATE TABLE t1 (
|
|
|
|
i int(11) DEFAULT NULL,
|
|
|
|
v1 varchar(1) DEFAULT NULL,
|
|
|
|
v2 varchar(20) DEFAULT NULL,
|
|
|
|
KEY i (i),
|
|
|
|
KEY v (v1,i)
|
|
|
|
) ENGINE=innodb;
|
|
|
|
|
|
|
|
INSERT INTO t1 VALUES (1,'f','no');
|
|
|
|
INSERT INTO t1 VALUES (2,'u','yes-u');
|
|
|
|
INSERT INTO t1 VALUES (2,'h','yes-h');
|
|
|
|
INSERT INTO t1 VALUES (3,'d','no');
|
|
|
|
|
|
|
|
--echo
|
|
|
|
SELECT v2
|
|
|
|
FROM t1
|
|
|
|
WHERE v1 IN ('f', 'd', 'h', 'u' ) AND i = 2;
|
|
|
|
|
|
|
|
--echo
|
|
|
|
--echo # Should not use index_merge
|
|
|
|
EXPLAIN
|
|
|
|
SELECT v2
|
|
|
|
FROM t1
|
|
|
|
WHERE v1 IN ('f', 'd', 'h', 'u' ) AND i = 2;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
2012-06-02 01:25:56 +02:00
|
|
|
--echo #
|
|
|
|
--echo # BUG#1006164: Multi-table DELETE that uses innodb + index_merge/intersect may fail to delete rows
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
create table t0(a int);
|
|
|
|
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
|
|
|
|
|
|
|
create table t1 (
|
|
|
|
pk int auto_increment,
|
|
|
|
zone_id int,
|
|
|
|
modified tinyint,
|
|
|
|
primary key(pk),
|
|
|
|
key (zone_id),
|
|
|
|
key (modified)
|
|
|
|
) engine=innodb;
|
|
|
|
|
|
|
|
insert into t1 (zone_id, modified) select 0,0 from t0 A, t0 B, t0 C, t0 D;
|
|
|
|
update t1 set zone_id=487, modified=9 where pk=7259;
|
|
|
|
update t1 set zone_id=487, modified=9 where pk=7260;
|
|
|
|
update t1 set zone_id=830, modified=9 where pk=8434;
|
|
|
|
update t1 set zone_id=830, modified=9 where pk=8435;
|
|
|
|
update t1 set zone_id=830, modified=9 where pk=8436;
|
|
|
|
update t1 set zone_id=830, modified=9 where pk=8437;
|
|
|
|
|
|
|
|
select * from t1 where t1.zone_id=830 AND modified=9;
|
|
|
|
begin;
|
|
|
|
DELETE t1 FROM t1 WHERE t1.zone_id=830 AND modified=9;
|
|
|
|
commit;
|
|
|
|
select * from t1 where t1.zone_id=830 AND modified=9;
|
|
|
|
|
|
|
|
drop table t0, t1;
|
|
|
|
|
2012-07-04 12:34:45 +02:00
|
|
|
--echo #
|
|
|
|
--echo # MDEV-376: Wrong result (missing rows) with index_merge+index_merge_intersection, join
|
|
|
|
--echo #
|
|
|
|
CREATE TABLE t1 (
|
|
|
|
a INT, b CHAR(1), c CHAR(1), KEY(a), KEY(b)
|
|
|
|
) ENGINE=InnoDB;
|
|
|
|
|
|
|
|
INSERT INTO t1 VALUES (8,'v','v'),(8,'m','m'),(9,'d','d');
|
|
|
|
|
|
|
|
|
|
|
|
SELECT ta.* FROM t1 AS ta, t1 AS tb
|
|
|
|
WHERE ( tb.b != ta.b OR tb.a = ta.a )
|
|
|
|
AND ( tb.b = ta.c OR tb.b = ta.b );
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
2012-06-02 01:25:56 +02:00
|
|
|
|
2010-12-02 08:39:39 +01:00
|
|
|
set optimizer_switch= @optimizer_switch_save;
|
2011-01-13 22:15:44 +01:00
|
|
|
|