mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge 10.1 into 10.2
This commit is contained in:
@@ -2,11 +2,10 @@
|
||||
#
|
||||
# Index merge tests
|
||||
#
|
||||
# The variables
|
||||
# $engine_type -- storage engine to be tested
|
||||
# The variable
|
||||
# $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.
|
||||
# has to be set before sourcing this script.
|
||||
#
|
||||
# Note: The comments/expectations refer to MyISAM.
|
||||
# They might be not valid for other storage engines.
|
||||
@@ -16,15 +15,10 @@
|
||||
# old name was t/index_merge.test
|
||||
# main code went into include/index_merge1.inc
|
||||
#
|
||||
--source include/have_sequence.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
|
||||
|
||||
# Create and fill a table with simple keys
|
||||
create table t0
|
||||
(
|
||||
@@ -32,20 +26,7 @@ create table t0
|
||||
INDEX i1(key1)
|
||||
);
|
||||
|
||||
--disable_query_log
|
||||
insert into t0 values (1),(2),(3),(4),(5),(6),(7),(8);
|
||||
|
||||
let $1=7;
|
||||
set @d=8;
|
||||
begin;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t0 select key1+@d from t0;
|
||||
eval set @d=@d*2;
|
||||
dec $1;
|
||||
}
|
||||
commit;
|
||||
--enable_query_log
|
||||
insert into t0(key1) select seq from seq_1_to_1024;
|
||||
|
||||
alter table t0 add key2 int not null, add index i2(key2);
|
||||
alter table t0 add key3 int not null, add index i3(key3);
|
||||
@@ -217,7 +198,7 @@ create table t4 (
|
||||
index i2_2(key2, key2_1)
|
||||
);
|
||||
|
||||
insert into t4 select key1,key1,key1 div 10, key1 % 10, key1 % 10, key1 from t0;
|
||||
insert into t4 select seq,seq,seq div 10, seq % 10, seq % 10, seq from seq_1_to_1024;
|
||||
|
||||
# the following will be handled by index_merge:
|
||||
select * from t4 where key1a = 3 or key1b = 4;
|
||||
@@ -392,14 +373,13 @@ 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,
|
||||
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;
|
||||
insert into t1 select @v:= seq % 10, @v, 't1', 'filler2' from seq_1_to_1000;
|
||||
|
||||
create table t2 like t1;
|
||||
|
||||
create table t3 (
|
||||
@@ -413,8 +393,7 @@ explain select * from t1 where a=1 and b=1;
|
||||
--replace_column 9 #
|
||||
explain select * from t3 where a=1 and b=1;
|
||||
|
||||
drop table t3;
|
||||
drop table t0, t1, t2;
|
||||
drop table t1, t2, t3;
|
||||
}
|
||||
|
||||
#
|
||||
@@ -513,16 +492,13 @@ DROP TABLE t1;
|
||||
--echo #
|
||||
--echo # BUG#40974: Incorrect query results when using clause evaluated using range check
|
||||
--echo #
|
||||
create table t0 (a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2);
|
||||
create table t2(a int, b int);
|
||||
insert into t2 values (1,1), (2, 1000);
|
||||
create table t3 (a int, b int, filler char(100), key(a), key(b));
|
||||
|
||||
insert into t3 select 1000, 1000,'filler' from t0 A, t0 B, t0 C;
|
||||
insert into t3 select 1000, 1000,'filler' from seq_1_to_1000;
|
||||
insert into t3 values (1,1,'data');
|
||||
insert into t3 values (1,1,'data');
|
||||
-- echo The plan should be ALL/ALL/ALL(Range checked for each record (index map: 0x3)
|
||||
@@ -534,20 +510,14 @@ select * from t1
|
||||
where exists (select 1 from t2, t3
|
||||
where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1));
|
||||
|
||||
drop table t0, t1, t2, t3;
|
||||
drop table t1, t2, t3;
|
||||
|
||||
--echo #
|
||||
--echo # BUG#44810: index merge and order by with low sort_buffer_size
|
||||
--echo # crashes server!
|
||||
--echo #
|
||||
CREATE TABLE t1(a VARCHAR(128),b VARCHAR(128),KEY(A),KEY(B));
|
||||
INSERT INTO t1 VALUES (REPEAT('a',128),REPEAT('b',128));
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT REPEAT('a',128),REPEAT('b',128) FROM seq_1_to_64;
|
||||
SET SESSION sort_buffer_size=1024*8;
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 FORCE INDEX(a,b) WHERE a LIKE 'a%' OR b LIKE 'b%'
|
||||
|
@@ -2,10 +2,6 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
@@ -14,15 +10,10 @@
|
||||
# old name was t/index_merge_innodb.test
|
||||
# main code went into include/index_merge2.inc
|
||||
#
|
||||
--source include/have_sequence.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,
|
||||
@@ -32,16 +23,7 @@ create table t1
|
||||
INDEX i2(key2)
|
||||
);
|
||||
|
||||
--disable_query_log
|
||||
let $1=200;
|
||||
begin;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t1 values (200-$1, $1);
|
||||
dec $1;
|
||||
}
|
||||
commit;
|
||||
--enable_query_log
|
||||
INSERT INTO t1 SELECT seq,200-seq FROM seq_0_to_200;
|
||||
|
||||
# No primary key
|
||||
explain select * from t1 where key1 < 5 or key2 > 197;
|
||||
@@ -80,16 +62,8 @@ create table t1 (
|
||||
index (key2)
|
||||
);
|
||||
show warnings;
|
||||
--disable_query_log
|
||||
let $1=30;
|
||||
begin;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t1 (key1, key2, filler) values ($1/4, $1/8, 'filler-data');
|
||||
dec $1;
|
||||
}
|
||||
commit;
|
||||
--enable_query_log
|
||||
INSERT INTO t1 (key1, key2, filler)
|
||||
SELECT seq/4, seq/8, 'filler-data' FROM seq_30_to_0;
|
||||
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;
|
||||
@@ -331,19 +305,7 @@ create table t1
|
||||
key3 int not null default 0
|
||||
);
|
||||
|
||||
insert into t1(key1) values (1),(2),(3),(4),(5),(6),(7),(8);
|
||||
|
||||
let $1=7;
|
||||
set @d=8;
|
||||
begin;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t1 (key1) select key1+@d from t1;
|
||||
eval set @d=@d*2;
|
||||
dec $1;
|
||||
}
|
||||
commit;
|
||||
|
||||
insert into t1(key1) select seq from seq_1_to_1024;
|
||||
alter table t1 add index i2(key2);
|
||||
alter table t1 add index i3(key3);
|
||||
update t1 set key2=key1,key3=key1;
|
||||
|
@@ -2,24 +2,15 @@
|
||||
#
|
||||
# 2-sweeps read Index_merge test
|
||||
#
|
||||
# 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
|
||||
#
|
||||
--source include/have_sequence.inc
|
||||
|
||||
--echo #---------------- 2-sweeps read Index merge test 2 -------------------------------
|
||||
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (
|
||||
pk int primary key,
|
||||
key1 int,
|
||||
@@ -30,17 +21,8 @@ create table t1 (
|
||||
index(key2)
|
||||
);
|
||||
|
||||
|
||||
--disable_query_log
|
||||
begin;
|
||||
let $1=1000;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t1 values($1, $1, $1, 'filler-data','filler-data-2');
|
||||
dec $1;
|
||||
}
|
||||
commit;
|
||||
--enable_query_log
|
||||
insert into t1 select seq, seq, seq, 'filler-data', 'filler-data-2'
|
||||
from seq_1000_to_1;
|
||||
|
||||
select * from t1 where (key1 >= 2 and key1 <= 10) or (pk >= 4 and pk <=8 );
|
||||
|
||||
|
@@ -17,11 +17,6 @@
|
||||
|
||||
--echo #---------------- ROR-index_merge tests -----------------------
|
||||
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t0,t1,t2;
|
||||
--enable_warnings
|
||||
create table t1
|
||||
(
|
||||
/* Field names reflect value(rowid) distribution, st=STairs, swt= SaWTooth */
|
||||
|
@@ -2,10 +2,6 @@
|
||||
#
|
||||
# Clustered PK 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 InnoDB.
|
||||
# They might be not valid for other storage engines.
|
||||
#
|
||||
@@ -15,14 +11,10 @@
|
||||
# main code went into include/index_merge_ror_cpk.inc
|
||||
#
|
||||
|
||||
--source include/have_sequence.inc
|
||||
|
||||
--echo #---------------- Clustered PK ROR-index_merge tests -----------------------------
|
||||
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1
|
||||
(
|
||||
pk1 int not null,
|
||||
|
Reference in New Issue
Block a user