[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.17.75.47: ~ $
#---------------- Index merge test 1 -------------------------------------------
SET SESSION DEFAULT_STORAGE_ENGINE = MyISAM;
drop table if exists t0, t1, t2, t3, t4;
create table t0
(
key1 int not null,
key2 int not null,
key3 int not null,
key4 int not null,
key5 int not null,
key6 int not null,
key7 int not null,
key8 int not null,
INDEX i1(key1),
INDEX i2(key2),
INDEX i3(key3),
INDEX i4(key4),
INDEX i5(key5),
INDEX i6(key6),
INDEX i7(key7),
INDEX i8(key8)
);
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 index condition
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	78	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 < 2 or key2 <3;
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	5	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 < 2 or key2 <3) 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	5	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<2 or key2<3 or (key1>5 and key1<7) or
(key1>10 and key1<12) or (key2>100 and key2<102);
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	8	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	NULL
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 < 2) 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	3	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 < 2 or key2 < 2) and (key3 < 3 or key4 < 3) 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	i3,i4	4,4	NULL	6	Using sort_union(i3,i4); Using where
explain
select * from t0 where (key1 < 2 or key2 < 4) and (key1 < 5 or key3 < 3);
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	6	Using sort_union(i1,i2); Using where
select * from t0 where (key1 < 2 or key2 < 4) and (key1 < 5 or key3 < 3);
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
explain select * from t0 where
(key1 < 3 or key2 < 2) and (key3 < 3 or key4 < 3) 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	i3,i4	4,4	NULL	6	Using sort_union(i3,i4); Using where
explain select * from t0 where
(key1 < 3 or key2 < 3) and (key3 < 70);
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	6	Using sort_union(i1,i2); 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	index_merge	i1,i2,i3	i1,i2	4,4	NULL	6	Using sort_union(i1,i2); Using where
explain select * from t0 where
((key1 < 3 or key2 < 3) and (key2 <4 or key3 < 3))
or
key2 > 4;
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 <4 or key3 < 3))
or
key1 < 5;
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 < 4 or key2 < 4) and (key2 <4 or key3 < 3))
or
key1 < 5;
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
explain select * from t0 where
((key1 < 2 or key2 < 2) and (key3 <4 or key5 < 3))
or
((key5 < 3 or key6 < 3) and (key7 <3 or key8 < 3));
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	10	Using sort_union(i1,i2,i5,i6); Using where
explain select * from t0 where
((key3 <3 or key5 < 4) and (key1 < 3 or key2 < 3))
or
((key7 <5 or key8 < 3) and (key5 < 4 or key6 < 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	i3,i5,i7,i8	4,4,4,4	NULL	16	Using sort_union(i3,i5,i7,i8); Using where
explain select * from t0 where
((key3 <3 or key5 < 4) and (key1 < 3 or key2 < 4))
or
((key3 <4 or key5 < 2) and (key5 < 5 or key6 < 3));
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	8	Using sort_union(i3,i5); Using where
explain select * from t0 where
((key3 <4 or key5 < 3) and (key1 < 3 or key2 < 3))
or
(((key3 <5 and key7 < 5) or key5 < 2) and (key5 < 4 or key6 < 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	i3,i5	4,4	NULL	8	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 <3 or key5 < 4) and (key1 < 3 or key2 < 3))
or
((key3 >4 or key5 < 2) and (key5 < 5 or key6 < 4));
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	1024	Using sort_union(i3,i5); 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	ALL	i1,i2,i3,i5,i6	NULL	NULL	NULL	1024	Using where
select * from t0 where key1 < 3 or key8 < 2 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
1023	1023	1023	1023	1023	1023	1023	1
1024	1024	1024	1024	1024	1024	1024	0
explain
select * from t0 where key1 < 3 or key8 < 2 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	6	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)
);
Warnings:
Note	1831	Duplicate index 'i2_2' defined on the table 'test.t4'. This is deprecated and will be disallowed in a future release.
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	NULL
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	NULL
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	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	NULL
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	NULL
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	NULL
1	SIMPLE	t1	index_merge	i1,i8	i1,i8	4,4	NULL	2	Using union(i1,i8); Using where; Using join buffer (Block Nested Loop)
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 index condition
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	Using temporary
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>	ALL	NULL	NULL	NULL	NULL	2	Using where
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= 4096;
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; Using join buffer (Block Nested Loop)
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; Using join buffer (Block Nested Loop)
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; Using join buffer (Block Nested Loop)
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;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(1);
CREATE TABLE t2(a INT, b INT, dummy CHAR(16) DEFAULT '', KEY(a), KEY(b));
INSERT INTO t2(a,b) VALUES
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
(1,2);
LOCK TABLES t1 WRITE, t2 WRITE;
INSERT INTO t2(a,b) VALUES(1,2);
SELECT t2.a FROM t1,t2 WHERE t2.b=2 AND t2.a=1;
a
1
1
UNLOCK TABLES;
DROP TABLE t1, t2;
CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`filler` char(200) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
KEY `a` (`a`),
KEY `b` (`b`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
insert into t1 values
(0, 'filler', 0), (1, 'filler', 1), (2, 'filler', 2), (3, 'filler', 3), 
(4, 'filler', 4), (5, 'filler', 5), (6, 'filler', 6), (7, 'filler', 7), 
(8, 'filler', 8), (9, 'filler', 9), (0, 'filler', 0), (1, 'filler', 1), 
(2, 'filler', 2), (3, 'filler', 3), (4, 'filler', 4), (5, 'filler', 5), 
(6, 'filler', 6), (7, 'filler', 7), (8, 'filler', 8), (9, 'filler', 9), 
(10, 'filler', 10), (11, 'filler', 11), (12, 'filler', 12), (13, 'filler', 13),
(14, 'filler', 14), (15, 'filler', 15), (16, 'filler', 16), (17, 'filler', 17), 
(18, 'filler', 18), (19, 'filler', 19), (4, '5      ', 0), (5, '4      ', 0), 
(4, '4      ', 0), (4, 'qq     ', 5), (5, 'qq     ', 4), (4, 'zz     ', 4);
create table t2(
`a` int(11) DEFAULT NULL,
`filler` char(200) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
KEY USING BTREE (`a`),
KEY USING BTREE (`b`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
insert into t2 select * from t1;
must use sort-union rather than union:
explain select * from t1 where a=4 or b=4;
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 sort_union(a,b); Using where
select * from t1 where a=4 or b=4;
a	filler	b
4	4	0
4	5	0
4	filler	4
4	filler	4
4	qq	5
4	zz	4
5	qq	4
select * from t1 ignore index(a,b) where a=4 or b=4;
a	filler	b
4	4	0
4	5	0
4	filler	4
4	filler	4
4	qq	5
4	zz	4
5	qq	4
must use union, not sort-union:
explain select * from t2 where a=4 or b=4;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	index_merge	a,b	a,b	5,5	NULL	#	Using union(a,b); Using where
select * from t2 where a=4 or b=4;
a	filler	b
4	4	0
4	5	0
4	filler	4
4	filler	4
4	qq	5
4	zz	4
5	qq	4
drop table t1, t2;
CREATE TABLE t1 (a varchar(8), b set('a','b','c','d','e','f','g','h'),
KEY b(b), KEY a(a));
INSERT INTO t1 VALUES ('y',''), ('z','');
SELECT b,a from t1 WHERE (b!='c' AND b!='f' && b!='h') OR 
(a='pure-S') OR (a='DE80337a') OR (a='DE80799');
b	a
	y
	z
DROP TABLE t1;
#
# BUG#40974: Incorrect query results when using clause evaluated using range check
#
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 values (1,1,'data');
insert into t3 values (1,1,'data');
The plan should be ALL/ALL/ALL(Range checked for each record (index map: 0x3)
explain 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));
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	2	Using where
2	DEPENDENT SUBQUERY	t2	ALL	NULL	NULL	NULL	NULL	2	Using where
2	DEPENDENT SUBQUERY	t3	ALL	a,b	NULL	NULL	NULL	1002	Range checked for each record (index map: 0x3)
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));
a
1
2
drop table t0, t1, t2, t3;
#
# BUG#44810: index merge and order by with low sort_buffer_size 
# crashes server!
#
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;
SET SESSION sort_buffer_size=1;
Warnings:
Warning	1292	Truncated incorrect sort_buffer_size value: '1'
EXPLAIN 
SELECT * FROM t1 FORCE INDEX(a,b) WHERE a LIKE 'a%' OR b LIKE 'b%' 
ORDER BY a,b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	index_merge	a,b	a,b	131,131	NULL	64	Using sort_union(a,b); Using where; Using filesort
SELECT * FROM t1 FORCE INDEX(a,b) WHERE a LIKE 'a%' OR b LIKE 'b%' 
ORDER BY a,b;
SET SESSION sort_buffer_size=DEFAULT;
DROP TABLE t1;
End of 5.0 tests
#---------------- ROR-index_merge tests -----------------------
SET SESSION DEFAULT_STORAGE_ENGINE = MyISAM;
drop table if exists  t0,t1,t2;
create table t1
(
/* Field names reflect value(rowid) distribution, st=STairs, swt= SaWTooth */
st_a int not null default 0,
swt1a int not null default 0,
swt2a int not null default 0,
st_b int not null default 0,
swt1b int not null default 0,
swt2b int not null default 0,
/* fields/keys for row retrieval tests */
key1 int,
key2 int,
key3 int,
key4 int,
/* make rows much bigger then keys */
filler1 char (200),
filler2 char (200),
filler3 char (200),
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),
key sta_swt2a(st_a,swt2a),
key sta_swt21a(st_a,swt2a,swt1a),
key st_a(st_a),
key stb_swt1a_2b(st_b,swt1b,swt2a),
key stb_swt1b(st_b,swt1b),
key st_b(st_b),
key(key1),
key(key2),
key(key3),
key(key4)
) ;
create table t0 as select * from t1;
# Printing of many insert into t0 values (....) disabled.
alter table t1 disable keys;
# Printing of many insert into t1 select .... from t0 disabled.
# Printing of many insert into t1 (...) values (....) disabled.
alter table t1 enable keys;
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
explain format=json select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100;
EXPLAIN
{
  "query_block": {
    "select_id": 1,
    "table": {
      "table_name": "t1",
      "access_type": "index_merge",
      "possible_keys": [
        "key1",
        "key2",
        "key3",
        "key4"
      ],
      "key": "union(intersect(key1,key2),intersect(key3,key4))",
      "key_length": "5,5,5,5",
      "rows": 154,
      "filtered": 50,
      "attached_condition": "(((`test`.`t1`.`key2` = 100) and (`test`.`t1`.`key1` = 100)) or ((`test`.`t1`.`key4` = 100) and (`test`.`t1`.`key3` = 100)))"
    }
  }
}
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`key1` AS `key1`,`test`.`t1`.`key2` AS `key2`,`test`.`t1`.`key3` AS `key3`,`test`.`t1`.`key4` AS `key4`,`test`.`t1`.`filler1` AS `filler1` from `test`.`t1` where (((`test`.`t1`.`key2` = 100) and (`test`.`t1`.`key1` = 100)) or ((`test`.`t1`.`key4` = 100) and (`test`.`t1`.`key3` = 100)))
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	NULL
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,stb_swt1b,sta_swt2a	8,8,8	NULL	57	Using intersect(sta_swt1a,stb_swt1b,sta_swt2a); 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;
CREATE TABLE t1(c1 INT, c2 INT DEFAULT 0, c3 CHAR(255) DEFAULT '',
KEY(c1), KEY(c2), KEY(c3));
INSERT INTO t1(c1) VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),
(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0);
INSERT INTO t1 VALUES(0,0,0);
CREATE TABLE t2(c1 int);
INSERT INTO t2 VALUES(1);
DELETE t1 FROM t1,t2 WHERE t1.c1=0 AND t1.c2=0;
SELECT * FROM t1;
c1	c2	c3
DROP TABLE t1,t2;
#---------------- Index merge test 2 -------------------------------------------
SET SESSION DEFAULT_STORAGE_ENGINE = MyISAM;
drop table if exists t1,t2;
create table t1
(
key1 int not null,
key2 int not null,
INDEX i1(key1),
INDEX i2(key2)
);
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	10	Using sort_union(i1,i2); Using where
select * from t1 where key1 < 5 or key2 > 197;
key1	key2
0	200
1	199
2	198
3	197
4	196
explain select * from t1 where key1 < 3 or key2 > 195;
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	10	Using sort_union(i1,i2); Using where
select * from t1 where key1 < 3 or key2 > 195;
key1	key2
0	200
1	199
2	198
3	197
4	196
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;
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	10	Using sort_union(i1,i2); Using where
select * from t1 where key1 < 5 or key2 > 197;
key1	key2	str1	zeroval	str2	str3
0	200	aaa	0	bbb	200-0_a
1	199	aaa	0	bbb	199-0_A
2	198	aaa	0	bbb	198-1_a
3	197	aaa	0	bbb	197-1_A
4	196	aaa	0	bbb	196-2_a
explain select * from t1 where key1 < 3 or key2 > 195;
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	10	Using sort_union(i1,i2); Using where
select * from t1 where key1 < 3 or key2 > 195;
key1	key2	str1	zeroval	str2	str3
0	200	aaa	0	bbb	200-0_a
1	199	aaa	0	bbb	199-0_A
2	198	aaa	0	bbb	198-1_a
3	197	aaa	0	bbb	197-1_A
4	196	aaa	0	bbb	196-2_a
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;
Level	Code	Message
explain select pk from t1 where key1 = 1 and key2 = 1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ref	key1,key2	key1	5	const	4	Using where
select pk from t1 where key2 = 1 and key1 = 1;
pk
26
27
select pk from t1 ignore index(key1,key2) where key2 = 1 and key1 = 1;
pk
26
27
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;
Table	Op	Msg_type	Msg_text
test.t1	analyze	status	OK
select count(*) from t1;
count(*)
5184
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	2	Using intersect(i1,i2); Using where; Using index
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
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	2	Using intersect(i1,i3); Using where; Using index
select count(*) from t1 where
key1a = 2 and key1b is null and key3a = 2 and key3b is null;
count(*)
4
drop table t1,t2;
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';
id1	id2
1	2004-01-01
drop table t1;
drop view if exists v1;
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;
oid	fk_bbk_niederlassung	fk_wochentag	uhrzeit_von	uhrzeit_bis	geloescht	version
21	7	1	08:00:00	13:00:00	0	1
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;
Table	Create 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=MyISAM DEFAULT CHARSET=latin1
select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6';
t_vers	t_rele	t_cust	filler1
7.6 	a 	    	
7.6 	a 	    	
select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6'
  and t_rele='a' and t_cust = ' ';
t_vers	t_rele	t_cust	filler1
7.6 	a 	    	
7.6 	a 	    	
drop table t1;
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;
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        ';
COUNT(*)
1
drop table t1;
create table t1
(
key1 int not null, 
key2 int not null default 0,
key3 int not null default 0
);
insert into t1(key1) values (1),(2),(3),(4),(5),(6),(7),(8);
set @d=8;
insert into t1 (key1) select key1+@d from t1;
set @d=@d*2;
insert into t1 (key1) select key1+@d from t1;
set @d=@d*2;
insert into t1 (key1) select key1+@d from t1;
set @d=@d*2;
insert into t1 (key1) select key1+@d from t1;
set @d=@d*2;
insert into t1 (key1) select key1+@d from t1;
set @d=@d*2;
insert into t1 (key1) select key1+@d from t1;
set @d=@d*2;
insert into t1 (key1) select key1+@d from t1;
set @d=@d*2;
alter table t1 add index i2(key2);
alter table t1 add index i3(key3);
update t1 set key2=key1,key3=key1;
explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	index_merge	i2,i3	i3,i2	4,4	NULL	11	Using sort_union(i3,i2); Using where
select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
key1	key2	key3
31	31	31
32	32	32
33	33	33
34	34	34
35	35	35
36	36	36
37	37	37
38	38	38
39	39	39
drop table t1;
#
# Bug#56423: Different count with SELECT and CREATE SELECT queries
#
CREATE TABLE t1 (
a INT,
b INT,
c INT,
d INT,
PRIMARY KEY (a),
KEY (c),
KEY bd (b,d)
);
INSERT INTO t1 VALUES
(1, 0, 1, 0),
(2, 1, 1, 1),
(3, 1, 1, 1),
(4, 0, 1, 1);
EXPLAIN
SELECT a
FROM t1
WHERE c = 1 AND b = 1 AND d = 1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ref	c,bd	bd	10	const,const	2	Using where
CREATE TABLE t2 ( a INT )
SELECT a
FROM t1
WHERE c = 1 AND b = 1 AND d = 1;
SELECT * FROM t2;
a
2
3
DROP TABLE t1, t2;
CREATE TABLE t1( a INT, b INT, KEY(a), KEY(b) );
INSERT INTO t1 VALUES (1, 2), (1, 2), (1, 2), (1, 2);
SELECT * FROM t1 FORCE INDEX(a, b) WHERE a = 1 AND b = 2;
a	b
1	2
1	2
1	2
1	2
DROP TABLE t1;
# Code coverage of fix.
CREATE TABLE t1 ( a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT);
INSERT INTO t1 (b) VALUES (1);
UPDATE t1 SET b = 2 WHERE a = 1;
SELECT * FROM t1;
a	b
1	2
CREATE TABLE t2 ( a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(1) );
INSERT INTO t2 (b) VALUES ('a');
UPDATE t2 SET b = 'b' WHERE a = 1;
SELECT * FROM t2;
a	b
1	b
DROP TABLE t1, t2;
#
# BUG#13970015: ASSERT `MIN_ENDP || MAX_ENDP' FAILED IN
#               HANDLER::MULTI_RANGE_READ_INFO_CONST
#
CREATE TABLE t1 (
pk INT NOT NULL,
col_int_key INT NOT NULL,
col_varchar_key VARCHAR(1) NOT NULL,
PRIMARY KEY (pk),
KEY col_int_key (col_int_key),
KEY col_varchar_key (col_varchar_key,col_int_key)
);
INSERT INTO t1 VALUES (1,1,'a'), (2,2,'b');
EXPLAIN
SELECT col_int_key
FROM t1
WHERE col_varchar_key >= 'l' OR 
(((pk BETWEEN 141 AND 141) OR col_varchar_key <> 'l') 
AND ((pk BETWEEN 141 AND 141) OR (col_int_key > 141)));
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	PRIMARY,col_int_key,col_varchar_key	NULL	NULL	NULL	2	Using where
SELECT col_int_key
FROM t1
WHERE col_varchar_key >= 'l' OR 
(((pk BETWEEN 141 AND 141) OR col_varchar_key <> 'l') 
AND ((pk BETWEEN 141 AND 141) OR (col_int_key > 141)));
col_int_key
DROP TABLE t1;
#---------------- 2-sweeps read Index merge test 2 -------------------------------
SET SESSION DEFAULT_STORAGE_ENGINE = MyISAM;
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
10	10	10	filler-data	filler-data-2
9	9	9	filler-data	filler-data-2
8	8	8	filler-data	filler-data-2
7	7	7	filler-data	filler-data-2
6	6	6	filler-data	filler-data-2
5	5	5	filler-data	filler-data-2
4	4	4	filler-data	filler-data-2
3	3	3	filler-data	filler-data-2
2	2	2	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
1000	1000	1000	filler-data	filler-data-2
999	999	999	filler-data	filler-data-2
998	998	998	filler-data	filler-data-2
997	997	997	filler-data	filler-data-2
996	996	996	filler-data	filler-data-2
995	995	995	filler-data	filler-data-2
994	994	994	filler-data	filler-data-2
993	993	993	filler-data	filler-data-2
992	992	992	filler-data	filler-data-2
991	991	991	filler-data	filler-data-2
60	60	60	filler-data	filler-data-2
54	54	54	filler-data	filler-data-2
53	53	53	filler-data	filler-data-2
52	52	52	filler-data	filler-data-2
51	51	51	filler-data	filler-data-2
50	50	50	filler-data	filler-data-2
18	18	18	filler-data	filler-data-2
14	14	14	filler-data	filler-data-2
13	13	13	filler-data	filler-data-2
12	12	12	filler-data	filler-data-2
11	11	11	filler-data	filler-data-2
4	4	4	filler-data	filler-data-2
3	3	3	filler-data	filler-data-2
2	2	2	filler-data	filler-data-2
1	1	1	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
1000	1000	1000	filler-data	filler-data-2
999	999	999	filler-data	filler-data-2
998	998	998	filler-data	filler-data-2
997	997	997	filler-data	filler-data-2
996	996	996	filler-data	filler-data-2
995	995	995	filler-data	filler-data-2
994	994	994	filler-data	filler-data-2
993	993	993	filler-data	filler-data-2
992	992	992	filler-data	filler-data-2
991	991	991	filler-data	filler-data-2
990	990	990	filler-data	filler-data-2
54	54	54	filler-data	filler-data-2
53	53	53	filler-data	filler-data-2
52	52	52	filler-data	filler-data-2
51	51	51	filler-data	filler-data-2
50	50	50	filler-data	filler-data-2
14	14	14	filler-data	filler-data-2
13	13	13	filler-data	filler-data-2
12	12	12	filler-data	filler-data-2
11	11	11	filler-data	filler-data-2
4	4	4	filler-data	filler-data-2
3	3	3	filler-data	filler-data-2
2	2	2	filler-data	filler-data-2
1	1	1	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
1000	1000	1000	filler-data	filler-data-2
999	999	999	filler-data	filler-data-2
998	998	998	filler-data	filler-data-2
997	997	997	filler-data	filler-data-2
996	996	996	filler-data	filler-data-2
995	995	995	filler-data	filler-data-2
994	994	994	filler-data	filler-data-2
993	993	993	filler-data	filler-data-2
992	992	992	filler-data	filler-data-2
991	991	991	filler-data	filler-data-2
54	54	54	filler-data	filler-data-2
53	53	53	filler-data	filler-data-2
52	52	52	filler-data	filler-data-2
51	51	51	filler-data	filler-data-2
50	50	50	filler-data	filler-data-2
14	14	14	filler-data	filler-data-2
13	13	13	filler-data	filler-data-2
12	12	12	filler-data	filler-data-2
11	11	11	filler-data	filler-data-2
4	4	4	filler-data	filler-data-2
3	3	3	filler-data	filler-data-2
2	2	2	filler-data	filler-data-2
1	1	1	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
1000	1000	1000	filler-data	filler-data-2
999	999	999	filler-data	filler-data-2
998	998	998	filler-data	filler-data-2
997	997	997	filler-data	filler-data-2
996	996	996	filler-data	filler-data-2
995	995	995	filler-data	filler-data-2
994	994	994	filler-data	filler-data-2
993	993	993	filler-data	filler-data-2
992	992	992	filler-data	filler-data-2
991	991	991	filler-data	filler-data-2
54	54	54	filler-data	filler-data-2
53	53	53	filler-data	filler-data-2
52	52	52	filler-data	filler-data-2
51	51	51	filler-data	filler-data-2
50	50	50	filler-data	filler-data-2
14	14	14	filler-data	filler-data-2
13	13	13	filler-data	filler-data-2
12	12	12	filler-data	filler-data-2
11	11	11	filler-data	filler-data-2
4	4	4	filler-data	filler-data-2
3	3	3	filler-data	filler-data-2
2	2	2	filler-data	filler-data-2
1	1	1	filler-data	filler-data-2
drop table t1;
#---------------- Clustered PK ROR-index_merge tests -----------------------------
SET SESSION DEFAULT_STORAGE_ENGINE = MyISAM;
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	ROWS	Using index condition; 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
select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1;
pk1	pk2
95	59
95	58
95	57
95	56
95	55
95	54
95	53
95	52
95	51
95	50
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	ROWS	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	ref	PRIMARY,key1	key1	4	const	ROWS	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	ref	key1,pktail1ok	pktail1ok	4	const	76	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	ref	key1,pktail2ok	pktail2ok	4	const	82	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	ROWS	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	EITHER_KEY	4	const	ROWS	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	pktail4bad	4	const	ROWS	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	pktail5bad	4	const	ROWS	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
select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10;
pk1	pk2	key1	key2
104	49	10	10
104	48	10	10
104	47	10	10
104	46	10	10
104	45	10	10
104	44	10	10
104	43	10	10
104	42	10	10
104	41	10	10
104	40	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;
#
# Bug#50402 Optimizer producing wrong results when using Index Merge on InnoDB
#
CREATE TABLE t1 (f1 INT, PRIMARY KEY (f1));
INSERT INTO t1 VALUES (2);
CREATE TABLE t2 (f1 INT, f2 INT, f3 char(1),
PRIMARY KEY (f1), KEY (f2), KEY (f3) );
INSERT INTO t2 VALUES (1, 1, 'h'), (2, 3, 'h'), (3, 2, ''), (4, 2, '');
SELECT t1.f1 FROM t1
WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
f1
2
EXPLAIN SELECT t1.f1 FROM t1
WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	PRIMARY	t1	system	PRIMARY	NULL	NULL	NULL	1	NULL
2	DEPENDENT SUBQUERY	t2	ref	f2,f3	f2	5	const	1	Using where
DROP TABLE t1,t2;
#
# Generic @@optimizer_switch tests (move those into a separate file if
#  we get another @@optimizer_switch user)
#
select @@optimizer_switch;
@@optimizer_switch
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,subquery_materialization_cost_based=on,use_index_extensions=on
set optimizer_switch='index_merge=off,index_merge_union=off';
select @@optimizer_switch;
@@optimizer_switch
index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,subquery_materialization_cost_based=on,use_index_extensions=on
set optimizer_switch='index_merge_union=on';
select @@optimizer_switch;
@@optimizer_switch
index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,subquery_materialization_cost_based=on,use_index_extensions=on
set optimizer_switch='default,index_merge_sort_union=off';
select @@optimizer_switch;
@@optimizer_switch
index_merge=on,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,subquery_materialization_cost_based=on,use_index_extensions=on
set optimizer_switch=4;
set optimizer_switch=NULL;
ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'NULL'
set optimizer_switch='default,index_merge';
ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge'
set optimizer_switch='index_merge=index_merge';
ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge=index_merge'
set optimizer_switch='index_merge=on,but...';
ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'but...'
set optimizer_switch='index_merge=';
ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge='
set optimizer_switch='index_merge';
ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge'
set optimizer_switch='on';
ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'on'
set optimizer_switch='index_merge=on,index_merge=off';
ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge=off'
set optimizer_switch='index_merge_union=on,index_merge_union=default';
ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge_union=default'
set optimizer_switch='default,index_merge=on,index_merge=off,default';
ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge=off,default'
set optimizer_switch=default;
set optimizer_switch='index_merge=off,index_merge_union=off,default';
select @@optimizer_switch;
@@optimizer_switch
index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,subquery_materialization_cost_based=on,use_index_extensions=on
set optimizer_switch=default;
select @@global.optimizer_switch;
@@global.optimizer_switch
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,subquery_materialization_cost_based=on,use_index_extensions=on
set @@global.optimizer_switch=default;
select @@global.optimizer_switch;
@@global.optimizer_switch
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,subquery_materialization_cost_based=on,use_index_extensions=on
#
# Check index_merge's @@optimizer_switch flags
#
select @@optimizer_switch;
@@optimizer_switch
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,subquery_materialization_cost_based=on,use_index_extensions=on
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, c int, filler char(100), 
key(a), key(b), key(c));
insert into t1 select 
A.a * B.a*10 + C.a*100, 
A.a * B.a*10 + C.a*100,
A.a, 
'filler'
from t0 A, t0 B, t0 C;
This should use union:
explain select * from t1 where a=1 or 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	2	Using union(a,b); Using where
This should use ALL:
set optimizer_switch='default,index_merge=off';
explain select * from t1 where a=1 or b=1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	a,b	NULL	NULL	NULL	1000	Using where
This should use sort-union:
set optimizer_switch='default,index_merge_union=off';
explain select * from t1 where a=1 or 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	2	Using sort_union(a,b); Using where
This will use sort-union:
set optimizer_switch=default;
explain select * from t1 where a<1 or 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	38	Using sort_union(a,b); Using where
This should use ALL:
set optimizer_switch='default,index_merge_sort_union=off';
explain select * from t1 where a<1 or b <1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	a,b	NULL	NULL	NULL	1000	Using where
This should use ALL:
set optimizer_switch='default,index_merge=off';
explain select * from t1 where a<1 or b <1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	a,b	NULL	NULL	NULL	1000	Using where
This will use sort-union:
set optimizer_switch='default,index_merge_union=off';
explain select * from t1 where a<1 or 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	38	Using sort_union(a,b); Using where
alter table t1 add d int, add key(d);
update t1 set d=a;
This will use sort_union:
set optimizer_switch=default;
explain select * from t1 where (a=3 or b in (1,2)) and (c=3 or d=4);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	index_merge	a,b,c,d	a,b	5,5	NULL	3	Using sort_union(a,b); Using where
And if we disable sort_union, union:
set optimizer_switch='default,index_merge_sort_union=off';
explain select * from t1 where (a=3 or b in (1,2)) and (c=3 or d=4);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	index_merge	a,b,c,d	c,d	5,5	NULL	100	Using union(c,d); Using where
drop table t1;
create table t1 (
a int, b int, c int,
filler1 char(200), filler2 char(200), 
key(a),key(b),key(c)
);
insert into t1 
select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a, 'foo', 'bar' 
from t0 A, t0 B, t0 C, t0 D where D.a<5;
This should be intersect:
set optimizer_switch=default;
explain select * from t1 where a=10 and b=10;
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	1	Using intersect(a,b); Using where
No intersect when index_merge is disabled:
set optimizer_switch='default,index_merge=off';
explain select * from t1 where a=10 and b=10;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ref	a,b	a	5	const	49	Using where
No intersect if it is disabled:
set optimizer_switch='default,index_merge_intersection=off';
explain select * from t1 where a=10 and b=10;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ref	a,b	a	5	const	49	Using where
Do intersect when union was disabled
set optimizer_switch='default,index_merge_union=off';
explain select * from t1 where a=10 and b=10;
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	1	Using intersect(a,b); Using where
Do intersect when sort_union was disabled
set optimizer_switch='default,index_merge_sort_union=off';
explain select * from t1 where a=10 and b=10;
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	1	Using intersect(a,b); Using where
This will use intersection inside a union:
set optimizer_switch=default;
explain select * from t1 where a=10 and b=10 or c=10;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	index_merge	a,b,c	a,b,c	5,5,5	NULL	6	Using union(intersect(a,b),c); Using where
Should be only union left:
set optimizer_switch='default,index_merge_intersection=off';
explain select * from t1 where a=10 and b=10 or c=10;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	index_merge	a,b,c	a,c	5,5	NULL	54	Using union(a,c); Using where
This will switch to sort-union (intersection will be gone, too,
thats a known limitation:
set optimizer_switch='default,index_merge_union=off';
explain select * from t1 where a=10 and b=10 or c=10;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	index_merge	a,b,c	a,c	5,5	NULL	54	Using sort_union(a,c); Using where
set optimizer_switch=default;
show variables like 'optimizer_switch';
Variable_name	Value
optimizer_switch	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,subquery_materialization_cost_based=on,use_index_extensions=on
drop table t0, t1;

Filemanager

Name Type Size Permission Actions
1st.result File 483 B 0644
alias.result File 13.42 KB 0644
almost_full.result File 1.11 KB 0644
alter_table-big.result File 3.12 KB 0644
alter_table.result File 108.41 KB 0644
analyze.result File 2.21 KB 0644
ansi.result File 1.14 KB 0644
archive-big.result File 616 B 0644
archive.result File 525.38 KB 0644
archive_bitfield.result File 4.26 KB 0644
archive_debug.result File 355 B 0644
archive_gis.result File 23.13 KB 0644
archive_no_symlink.result File 882 B 0644
archive_plugin.result File 543 B 0644
archive_symlink.result File 2.07 KB 0644
audit_plugin.result File 744 B 0644
auth_rpl.result File 1.85 KB 0644
auto_increment.result File 11.72 KB 0644
backup.result File 4.29 KB 0644
bench_count_distinct.result File 462 B 0644
big_test.require File 17 B 0644
bigint.result File 20.72 KB 0644
binary.result File 5.67 KB 0644
binary_to_hex.result File 5.87 KB 0644
binlog_tx_isolation.result File 1.71 KB 0644
blackhole.result File 613 B 0644
blackhole_plugin.result File 571 B 0644
bool.result File 2.56 KB 0644
bootstrap.result File 267 B 0644
bug12427262.result File 1.86 KB 0644
bug12969156.result File 952 B 0644
bug17076131.result File 322 B 0644
bug33509.result File 2.31 KB 0644
bug39022.result File 1.2 KB 0644
bug46080.result File 669 B 0644
bug46261.result File 382 B 0644
bug46760.result File 1.26 KB 0644
bug47671.result File 287 B 0644
bug58669.result File 480 B 0644
bulk_replace.result File 281 B 0644
cache_innodb.result File 5.42 KB 0644
case.result File 10.06 KB 0644
case_insensitive_file_system.require File 46 B 0644
case_sensitive_file_system.require File 47 B 0644
cast.result File 15.75 KB 0644
change_user.result File 3.31 KB 0644
check.result File 1.42 KB 0644
check_auto_permission.result File 251 B 0644
check_var_limit.require File 8 B 0644
client_xml.result File 2.38 KB 0644
comment_column.result File 140.57 KB 0644
comment_column2.result File 355.68 KB 0644
comment_index.result File 173.03 KB 0644
comment_table.result File 28.72 KB 0644
comments.result File 2.34 KB 0644
commit.result File 13.32 KB 0644
commit_1innodb.result File 19.19 KB 0644
compare.result File 3.17 KB 0644
compress.result File 56.5 KB 0644
concurrent_innodb_safelog.result File 31.89 KB 0644
concurrent_innodb_unsafelog.result File 31.61 KB 0644
connect.result File 12.75 KB 0644
connect_debug.result File 1.48 KB 0644
consistent_snapshot.result File 1.14 KB 0644
constraints.result File 2.55 KB 0644
count_distinct.result File 7.89 KB 0644
count_distinct2.result File 2.21 KB 0644
count_distinct3.result File 278 B 0644
create-big.result File 7.6 KB 0644
create.result File 147.09 KB 0644
create_not_windows.result File 961 B 0644
create_select_tmp.result File 846 B 0644
csv.result File 58.88 KB 0644
csv_alter_table.result File 1.17 KB 0644
csv_not_null.result File 1.75 KB 0644
ctype_ascii.result File 2.11 KB 0644
ctype_big5.result File 33.85 KB 0644
ctype_binary.result File 82.34 KB 0644
ctype_collate.result File 13.5 KB 0644
ctype_cp1250_ch.result File 21.88 KB 0644
ctype_cp1251.result File 96.09 KB 0644
ctype_cp932.result File 996 B 0644
ctype_cp932_binlog_row.result File 607 B 0644
ctype_cp932_binlog_stm.result File 251.22 KB 0644
ctype_create.result File 3.12 KB 0644
ctype_errors.result File 1.66 KB 0644
ctype_eucjpms.result File 400.21 KB 0644
ctype_euckr.result File 434.59 KB 0644
ctype_filename.result File 324 B 0644
ctype_filesystem.result File 341 B 0644
ctype_gb2312.result File 33.29 KB 0644
ctype_gbk.result File 49.63 KB 0644
ctype_gbk_binlog.result File 647 B 0644
ctype_hebrew.result File 254 B 0644
ctype_latin1.result File 118.67 KB 0644
ctype_latin1_de.result File 15.74 KB 0644
ctype_latin2.result File 13.32 KB 0644
ctype_latin2_ch.result File 25.11 KB 0644
ctype_ldml.result File 28.05 KB 0644
ctype_like_range.result File 80.89 KB 0644
ctype_many.result File 42.67 KB 0644
ctype_mb.result File 2.13 KB 0644
ctype_recoding.result File 9.6 KB 0644
ctype_sjis.result File 195.68 KB 0644
ctype_tis620.result File 100.45 KB 0644
ctype_uca.result File 154.97 KB 0644
ctype_ucs.result File 142.4 KB 0644
ctype_ucs2_def.result File 1.05 KB 0644
ctype_ujis.result File 364.9 KB 0644
ctype_ujis_ucs2.result File 548.59 KB 0644
ctype_utf16.result File 44.96 KB 0644
ctype_utf16_def.result File 273 B 0644
ctype_utf16_uca.result File 72.28 KB 0644
ctype_utf16le.result File 50.54 KB 0644
ctype_utf32.result File 48.05 KB 0644
ctype_utf32_uca.result File 75.11 KB 0644
ctype_utf8.result File 167.06 KB 0644
ctype_utf8mb4.result File 80.38 KB 0644
ctype_utf8mb4_heap.result File 72.21 KB 0644
ctype_utf8mb4_innodb.result File 74.62 KB 0644
ctype_utf8mb4_myisam.result File 74.63 KB 0644
ctype_utf8mb4_uca.result File 38.82 KB 0644
date_formats.result File 24.96 KB 0644
ddl_i18n_koi8r.result File 113.33 KB 0644
ddl_i18n_utf8.result File 116.35 KB 0644
deadlock_innodb.result File 2.35 KB 0644
debug_sync.result File 11.85 KB 0644
debug_sync2.result File 434 B 0644
default.result File 8.02 KB 0644
delayed.result File 17.7 KB 0644
delete.result File 16 KB 0644
deprecated_features.result File 2.03 KB 0644
derived.result File 78.6 KB 0644
dirty_close.result File 345 B 0644
disabled_replication.result File 3.01 KB 0644
disconnect_on_expired_password_default.result File 1.4 KB 0644
disconnect_on_expired_password_off.result File 1.36 KB 0644
distinct.result File 30.85 KB 0644
drop-no_root.result File 454 B 0644
drop.result File 5.73 KB 0644
drop_debug.result File 485 B 0644
ds_mrr-big.result File 2.14 KB 0644
dynamic_tracing.result File 813 B 0644
empty_table.result File 229 B 0644
enable_cleartext_plugin.result File 1.35 KB 0644
endspace.result File 6.61 KB 0644
eq_range_idx_stat.result File 4.02 KB 0644
error_simulation.result File 3.23 KB 0644
errors.result File 5.93 KB 0644
events_1.result File 22.18 KB 0644
events_2.result File 17.23 KB 0644
events_bugs.result File 37.35 KB 0644
events_embedded.result File 86 B 0644
events_grant.result File 10.33 KB 0644
events_logs_tests.result File 2.37 KB 0644
events_microsec.result File 810 B 0644
events_restart.result File 4.15 KB 0644
events_scheduling.result File 3.11 KB 0644
events_stress.result File 2.39 KB 0644
events_time_zone.result File 5.4 KB 0644
events_trans.result File 3.49 KB 0644
events_trans_notembedded.result File 1.37 KB 0644
execution_constants.result File 1.05 KB 0644
explain.result File 28.33 KB 0644
explain_json_all.result File 63.13 KB 0644
explain_json_none.result File 64.7 KB 0644
file_contents.result File 181 B 0644
filesort_debug.result File 2.79 KB 0644
fix_priv_tables.result File 1.3 KB 0644
flush.result File 13.75 KB 0644
flush2.result File 882 B 0644
flush_block_commit.result File 1.47 KB 0644
flush_block_commit_notembedded.result File 770 B 0644
flush_read_lock.result File 72.07 KB 0644
flush_read_lock_kill.result File 1.12 KB 0644
flush_table.result File 11.22 KB 0644
foreign_key.result File 3.33 KB 0644
fulltext.result File 28.72 KB 0644
fulltext2.result File 7.54 KB 0644
fulltext3.result File 540 B 0644
fulltext_cache.result File 2.67 KB 0644
fulltext_distinct.result File 1.25 KB 0644
fulltext_left_join.result File 4 KB 0644
fulltext_multi.result File 766 B 0644
fulltext_order_by.result File 5.83 KB 0644
fulltext_plugin.result File 229 B 0644
fulltext_update.result File 930 B 0644
fulltext_var.result File 1.3 KB 0644
func_aes.result File 12.78 KB 0644
func_aes_cfb1.result File 4.5 KB 0644
func_aes_cfb128.result File 4.57 KB 0644
func_aes_cfb8.result File 4.5 KB 0644
func_aes_misc.result File 8.28 KB 0644
func_aes_ofb.result File 4.47 KB 0644
func_analyse.result File 19.01 KB 0644
func_compress.result File 4.84 KB 0644
func_concat.result File 4.03 KB 0644
func_crypt.result File 4.37 KB 0644
func_date_add.result File 3.62 KB 0644
func_default.result File 1.19 KB 0644
func_des_encrypt.result File 1018 B 0644
func_digest.result File 121.48 KB 0644
func_encrypt.result File 10.33 KB 0644
func_encrypt_nossl.result File 4.21 KB 0644
func_encrypt_ucs2.result File 765 B 0644
func_equal.result File 1.27 KB 0644
func_gconcat.result File 48.53 KB 0644
func_group.result File 54.64 KB 0644
func_group_innodb.result File 5.12 KB 0644
func_group_innodb_16k.result File 544 B 0644
func_if.result File 6.05 KB 0644
func_in_all.result File 27.62 KB 0644
func_in_icp.result File 27.26 KB 0644
func_in_icp_mrr.result File 27.57 KB 0644
func_in_mrr.result File 27.29 KB 0644
func_in_mrr_cost.result File 27.01 KB 0644
func_in_none.result File 26.96 KB 0644
func_isnull.result File 827 B 0644
func_like.result File 4.45 KB 0644
func_math.result File 28.06 KB 0644
func_misc.result File 28.2 KB 0644
func_op.result File 1.93 KB 0644
func_regexp.result File 4.37 KB 0644
func_rollback.result File 12.44 KB 0644
func_sapdb.result File 12.38 KB 0644
func_set.result File 8.51 KB 0644
func_str.result File 157.75 KB 0644
func_str_debug.result File 349 B 0644
func_str_no_ps.result File 1.07 KB 0644
func_system.result File 2.63 KB 0644
func_test.result File 13.44 KB 0644
func_time.result File 67.37 KB 0644
func_timestamp.result File 518 B 0644
func_weight_string.result File 3.44 KB 0644
function_defaults.result File 109.23 KB 0644
function_defaults_notembedded.result File 6.38 KB 0644
gcc296.result File 528 B 0644
get_diagnostics.result File 24.96 KB 0644
gis-debug.result File 16.13 KB 0644
gis-precise.result File 28.34 KB 0644
gis-rt-precise.result File 1.86 KB 0644
gis-rtree.result File 78.36 KB 0644
gis.result File 58.53 KB 0644
grant.result File 95.95 KB 0644
grant2.result File 31.12 KB 0644
grant3.result File 7.15 KB 0644
grant4.result File 8.85 KB 0644
grant_cache.result File 5.62 KB 0644
grant_explain_non_select.result File 9.5 KB 0644
grant_lowercase_fs.result File 557 B 0644
greedy_optimizer.result File 592.8 KB 0644
greedy_search.result File 12.42 KB 0644
group_by.result File 84.6 KB 0644
group_min_max.result File 115.33 KB 0644
group_min_max_innodb.result File 17.52 KB 0644
handler_innodb.result File 40.72 KB 0644
handler_myisam.result File 44.62 KB 0644
handler_read_last.result File 1.15 KB 0644
have_big5.require File 79 B 0644
have_binlog_format_mixed.require File 40 B 0644
have_binlog_format_row.require File 38 B 0644
have_binlog_format_statement.require File 44 B 0644
have_binlog_rows_query.require File 53 B 0644
have_compress.require File 38 B 0644
have_cp1250_ch.require File 79 B 0644
have_cp1251.require File 84 B 0644
have_cp866.require File 82 B 0644
have_cp932.require File 83 B 0644
have_crypt.require File 35 B 0644
have_debug.require File 8 B 0644
have_debug_sync.require File 13 B 0644
have_eucjpms.require File 87 B 0644
have_euckr.require File 81 B 0644
have_gb2312.require File 84 B 0644
have_gbk.require File 78 B 0644
have_geometry.require File 38 B 0644
have_koi8r.require File 81 B 0644
have_latin2_ch.require File 78 B 0644
have_local_infile.require File 36 B 0644
have_log_bin.require File 31 B 0644
have_met_timezone.require File 43 B 0644
have_moscow_leap_timezone.require File 46 B 0644
have_mysql_upgrade.result File 21 B 0644
have_ndb_extra.require File 14 B 0644
have_ndbapi_examples.require File 19 B 0644
have_nodebug.require File 8 B 0644
have_optimizer_switch.require File 19 B 0644
have_outfile.require File 55 B 0644
have_partition.require File 42 B 0644
have_perror.require File 14 B 0644
have_profiling.require File 39 B 0644
have_query_cache.require File 41 B 0644
have_sjis.require File 81 B 0644
have_ssl.require File 33 B 0644
have_ssl_is_yes_or_disabled_only.require File 43 B 0644
have_symlink.require File 37 B 0644
have_tis620.require File 81 B 0644
have_ucs2.require File 80 B 0644
have_ujis.require File 81 B 0644
have_utf16.require File 82 B 0644
have_utf32.require File 82 B 0644
have_utf8.require File 80 B 0644
have_utf8mb4.require File 86 B 0644
having.result File 19.72 KB 0644
heap.result File 20.86 KB 0644
heap_auto_increment.result File 894 B 0644
heap_btree.result File 9.32 KB 0644
heap_hash.result File 14.37 KB 0644
help.result File 6.46 KB 0644
host_cache_size_functionality.result File 3.32 KB 0644
implicit_char_to_num_conversion.result File 6.44 KB 0644
implicit_commit.result File 17.71 KB 0644
import_schema_mismatch.result File 538 B 0644
index_merge_delete.result File 25.88 KB 0644
index_merge_innodb.result File 61.63 KB 0644
index_merge_insert-and-replace.result File 12.55 KB 0644
index_merge_intersect_dml.result File 4.96 KB 0644
index_merge_myisam.result File 73.48 KB 0644
index_merge_update.result File 16.41 KB 0644
information_schema-big.result File 2.81 KB 0644
information_schema.result File 87.98 KB 0644
information_schema_chmod.result File 182 B 0644
information_schema_db.result File 9.29 KB 0644
information_schema_inno.result File 4.33 KB 0644
information_schema_parameters.result File 22.11 KB 0644
information_schema_part.result File 9.71 KB 0644
information_schema_routines.result File 28.64 KB 0644
init_connect.result File 2.53 KB 0644
init_file.result File 323 B 0644
innodb_explain_json_non_select_all.result File 220.92 KB 0644
innodb_explain_json_non_select_none.result File 225.15 KB 0644
innodb_explain_non_select_all.result File 119.15 KB 0644
innodb_explain_non_select_none.result File 119.03 KB 0644
innodb_icp.result File 26.73 KB 0644
innodb_icp_all.result File 26.79 KB 0644
innodb_icp_none.result File 26.63 KB 0644
innodb_ignore_builtin.result File 354 B 0644
innodb_log_file_size_functionality.result File 2.79 KB 0644
innodb_mrr.result File 20.3 KB 0644
innodb_mrr_all.result File 20.47 KB 0644
innodb_mrr_cost.result File 20.27 KB 0644
innodb_mrr_cost_all.result File 20.43 KB 0644
innodb_mrr_cost_icp.result File 20.38 KB 0644
innodb_mrr_icp.result File 20.41 KB 0644
innodb_mrr_none.result File 20.22 KB 0644
innodb_mysql_lock.result File 5.52 KB 0644
innodb_mysql_lock2.result File 21.27 KB 0644
innodb_mysql_sync.result File 17.65 KB 0644
innodb_pk_extension_off.result File 14.06 KB 0644
innodb_pk_extension_on.result File 14.33 KB 0644
innodb_recovery_with_upper_case_names.result File 1.21 KB 0644
insert.result File 26.41 KB 0644
insert_debug.result File 1.29 KB 0644
insert_notembedded.result File 5.72 KB 0644
insert_select.result File 14.04 KB 0644
insert_update.result File 9.64 KB 0644
ipv4_as_ipv6.result File 21.69 KB 0644
ipv6.result File 12.49 KB 0644
is_debug_build.require File 32 B 0644
is_embedded.require File 16 B 0644
isam.result File 15.65 KB 0644
join.result File 46.84 KB 0644
join_cache_bka.result File 88.08 KB 0644
join_cache_bka_nixbnl.result File 87.38 KB 0644
join_cache_bkaunique.result File 88.54 KB 0644
join_cache_bnl.result File 86.26 KB 0644
join_cache_nojb.result File 85.38 KB 0644
join_crash.result File 4.59 KB 0644
join_nested.result File 62.76 KB 0644
join_nested_bka.result File 66.92 KB 0644
join_nested_bka_nixbnl.result File 63.95 KB 0644
join_optimizer.result File 2.54 KB 0644
join_outer.result File 63.99 KB 0644
join_outer_bka.result File 64.28 KB 0644
join_outer_bka_nixbnl.result File 62.57 KB 0644
join_outer_innodb.result File 1.86 KB 0644
key.result File 20.98 KB 0644
key_cache.result File 10.91 KB 0644
key_diff.result File 853 B 0644
key_primary.result File 666 B 0644
keywords.result File 6.63 KB 0644
kill.result File 8.37 KB 0644
kill_debug.result File 1.56 KB 0644
limit.result File 4.12 KB 0644
loaddata.result File 16.91 KB 0644
loaddata_autocom_innodb.result File 637 B 0644
loadxml.result File 2.71 KB 0644
locale.result File 5.59 KB 0644
lock.result File 15.03 KB 0644
lock_multi.result File 11.53 KB 0644
lock_multi_bug38499.result File 691 B 0644
lock_multi_bug38691.result File 539 B 0644
lock_sync.result File 31.17 KB 0644
lock_tables_lost_commit.result File 150 B 0644
log_empty_name.result File 247 B 0644
log_errchk.result File 664 B 0644
log_state.result File 9.66 KB 0644
log_state_bug33693.result File 111 B 0644
log_tables-big.result File 996 B 0644
log_tables.result File 40.97 KB 0644
log_tables_debug.result File 838 B 0644
log_tables_upgrade.result File 2.48 KB 0644
long_tmpdir.result File 99 B 0644
lowercase0.require File 45 B 0644
lowercase1.require File 45 B 0644
lowercase2.require File 45 B 0644
lowercase_fs_off.result File 2.05 KB 0644
lowercase_fs_on.result File 75 B 0644
lowercase_mixed_tmpdir.result File 176 B 0644
lowercase_mixed_tmpdir_innodb.result File 190 B 0644
lowercase_table.result File 2.67 KB 0644
lowercase_table2.result File 8.66 KB 0644
lowercase_table4.result File 3.68 KB 0644
lowercase_table_grant.result File 1.5 KB 0644
lowercase_table_qcache.result File 649 B 0644
lowercase_utf8.result File 173 B 0644
lowercase_view.result File 10.22 KB 0644
mdl_sync.result File 89.85 KB 0644
merge-big.result File 728 B 0644
merge.result File 97.6 KB 0644
merge_innodb.result File 1.31 KB 0644
merge_mmap.result File 3.33 KB 0644
metadata.result File 13.88 KB 0644
mix2_myisam.result File 57.76 KB 0644
mix2_myisam_ucs2.result File 15.31 KB 0644
multi_plugin_load.result File 347 B 0644
multi_plugin_load_add.result File 455 B 0644
multi_plugin_load_add2.result File 455 B 0644
multi_statement.result File 563 B 0644
multi_update.result File 23.21 KB 0644
multi_update2.result File 1016 B 0644
multi_update_innodb.result File 2.56 KB 0644
multi_update_tiny_hash.result File 1.5 KB 0644
myisam-blob.result File 1.25 KB 0644
myisam-system.result File 391 B 0644
myisam.result File 90.78 KB 0644
myisam_crash_before_flush_keys.result File 1.15 KB 0644
myisam_debug.result File 1.21 KB 0644
myisam_explain_json_non_select_all.result File 217.3 KB 0644
myisam_explain_json_non_select_none.result File 221.32 KB 0644
myisam_explain_non_select_all.result File 116.26 KB 0644
myisam_explain_non_select_none.result File 115.98 KB 0644
myisam_icp.result File 26.57 KB 0644
myisam_icp_all.result File 26.63 KB 0644
myisam_icp_none.result File 26.45 KB 0644
myisam_mrr.result File 19.24 KB 0644
myisam_mrr_all.result File 19.44 KB 0644
myisam_mrr_cost.result File 19.19 KB 0644
myisam_mrr_cost_all.result File 19.39 KB 0644
myisam_mrr_cost_icp.result File 19.33 KB 0644
myisam_mrr_icp.result File 19.38 KB 0644
myisam_mrr_none.result File 19.14 KB 0644
myisam_recover.result File 4.57 KB 0644
myisam_row_rpl.result File 2.04 KB 0644
myisampack.result File 7.56 KB 0644
mysql-bug41486.result File 465 B 0644
mysql-bug45236.result File 329 B 0644
mysql.result File 8.67 KB 0644
mysql_binary_mode.result File 1.52 KB 0644
mysql_client_test.result File 8.92 KB 0644
mysql_client_test_embedded.result File 111 B 0644
mysql_client_test_qcache.result File 502 B 0644
mysql_comments.result File 5.02 KB 0644
mysql_config_editor.result File 6.6 KB 0644
mysql_cp932.result File 37 B 0644
mysql_embedded.result File 171 B 0644
mysql_embedded_client_test.result File 153 B 0644
mysql_locale_posix.result File 973 B 0644
mysql_not_windows.result File 80 B 0644
mysql_plugin.result File 3.88 KB 0644
mysql_protocols.result File 208 B 0644
mysql_upgrade.result File 26.82 KB 0644
mysql_upgrade_ssl.result File 1.99 KB 0644
mysqladmin.result File 872 B 0644
mysqladmin_shutdown.result File 157 B 0644
mysqlbinlog.result File 30.17 KB 0644
mysqlbinlog_debug.result File 235 B 0644
mysqlbinlog_mixed_or_statment.result File 855 B 0644
mysqlbinlog_raw_mode.result File 8.32 KB 0644
mysqlbinlog_raw_mode_win.result File 8.08 KB 0644
mysqlbinlog_row_big.result File 2.42 KB 0644
mysqlcheck.result File 15.2 KB 0644
mysqld--defaults-file.result File 710 B 0644
mysqld--help-notwin.result File 53.91 KB 0644
mysqld--help-win.result File 54.47 KB 0644
mysqldump-compat.result File 111 B 0644
mysqldump-max.result File 10.95 KB 0644
mysqldump-no-binlog.result File 50 B 0644
mysqldump.result File 280.61 KB 0644
mysqldump_restore.result File 3.78 KB 0644
mysqlhotcopy_archive.result File 1.8 KB 0644
mysqlhotcopy_myisam.result File 2.28 KB 0644
mysqlimport.result File 490 B 0644
mysqlshow.result File 7.56 KB 0644
mysqlslap.result File 6.88 KB 0644
mysqltest.result File 31.15 KB 0644
named_pipe.result File 56.25 KB 0644
ndb_default_cluster.require File 51 B 0644
negation_elimination.result File 8.72 KB 0644
no-threads.result File 329 B 0644
no_binlog.result File 64 B 0644
not_embedded.require File 16 B 0644
not_embedded_server.result File 5.63 KB 0644
not_ndb.require File 39 B 0644
not_openssl.require File 36 B 0644
not_partition.result File 4.14 KB 0644
not_ssl.require File 32 B 0644
not_true.require File 10 B 0644
not_valgrind.require File 17 B 0644
not_windows.require File 7 B 0644
null.result File 14.48 KB 0644
null_key_all.result File 15.6 KB 0644
null_key_icp.result File 15.53 KB 0644
null_key_none.result File 15.47 KB 0644
odbc.result File 954 B 0644
olap.result File 19.13 KB 0644
one_thread_per_connection.require File 44 B 0644
openssl.require File 37 B 0644
openssl_1.result File 8.04 KB 0644
optimizer_bug12837084.result File 13.97 KB 0644
optimizer_debug_sync.result File 1.32 KB 0644
optimizer_switch.result File 19.94 KB 0644
order_by_all.result File 61.42 KB 0644
order_by_icp_mrr.result File 61.37 KB 0644
order_by_none.result File 61.15 KB 0644
order_by_sortkey.result File 2.91 KB 0644
order_fill_sortbuf.result File 262 B 0644
outfile.result File 2.09 KB 0644
outfile_loaddata.result File 10.12 KB 0644
overflow.result File 235 B 0644
packet.result File 5 KB 0644
parser.result File 38.22 KB 0644
parser_bug21114_innodb.result File 25.39 KB 0644
parser_not_embedded.result File 4.42 KB 0644
parser_precedence.result File 23.96 KB 0644
parser_stack.result File 9.54 KB 0644
partition.result File 76.63 KB 0644
partition_archive.result File 4.51 KB 0644
partition_binlog.result File 2.3 KB 0644
partition_binlog_stmt.result File 442 B 0644
partition_blackhole.result File 174 B 0644
partition_bug18198.result File 8.07 KB 0644
partition_cache.result File 5.16 KB 0644
partition_charset.result File 434 B 0644
partition_column.result File 23.07 KB 0644
partition_column_prune.result File 2.83 KB 0644
partition_csv.result File 1.83 KB 0644
partition_datatype.result File 39.34 KB 0644
partition_debug_sync.result File 3.19 KB 0644
partition_disabled.result File 4.59 KB 0644
partition_error.result File 82.17 KB 0644
partition_exchange.result File 37.6 KB 0644
partition_explicit_prune.result File 55.63 KB 0644
partition_federated.result File 271 B 0644
partition_grant.result File 1.54 KB 0644
partition_hash.result File 7.12 KB 0644
partition_index_innodb.result File 4.04 KB 0644
partition_index_myisam.result File 3.21 KB 0644
partition_innodb.result File 30.66 KB 0644
partition_innodb_plugin.result File 5.26 KB 0644
partition_innodb_semi_consistent.result File 2.92 KB 0644
partition_innodb_stmt.result File 1.12 KB 0644
partition_innodb_tablespace.result File 12.76 KB 0644
partition_key_cache.result File 16.74 KB 0644
partition_list.result File 12.92 KB 0644
partition_locking.result File 238.13 KB 0644
partition_locking_4.result File 1.7 KB 0644
partition_mgm.result File 4.7 KB 0644
partition_mgm_err.result File 7.48 KB 0644
partition_mgm_err2.result File 43 B 0644
partition_myisam.result File 7.67 KB 0644
partition_not_blackhole.result File 456 B 0644
partition_not_windows.result File 3.47 KB 0644
partition_open_files_limit.result File 1.02 KB 0644
partition_order.result File 16.29 KB 0644
partition_pruning.result File 166.97 KB 0644
partition_range.result File 33.91 KB 0644
partition_rename_longfilename.result File 2.89 KB 0644
partition_symlink.result File 4.89 KB 0644
partition_sync.result File 1.34 KB 0644
partition_truncate.result File 751 B 0644
partition_utf8.result File 2 KB 0644
partition_windows.result File 1.18 KB 0644
perror-win.result File 453 B 0644
perror.result File 471 B 0644
plugin.result File 7.73 KB 0644
plugin_auth.result File 23.39 KB 0644
plugin_auth_qa.result File 20.77 KB 0644
plugin_auth_qa_1.result File 13.74 KB 0644
plugin_auth_qa_2.result File 8.87 KB 0644
plugin_auth_qa_3.result File 1.14 KB 0644
plugin_auth_sha256.result File 3.97 KB 0644
plugin_auth_sha256_2.result File 1.49 KB 0644
plugin_auth_sha256_server_default.result File 2.7 KB 0644
plugin_auth_sha256_server_default_tls.result File 2.83 KB 0644
plugin_auth_sha256_tls.result File 1.82 KB 0644
plugin_load.result File 76 B 0644
plugin_load_option.result File 321 B 0644
plugin_not_embedded.result File 474 B 0644
preload.result File 3.84 KB 0644
profiling.result File 16.13 KB 0644
ps.result File 116.73 KB 0644
ps_10nestset.result File 2.08 KB 0644
ps_11bugs.result File 5.92 KB 0644
ps_1general.result File 35.91 KB 0644
ps_2myisam.result File 103.82 KB 0644
ps_3innodb.result File 103.36 KB 0644
ps_4heap.result File 103.28 KB 0644
ps_5merge.result File 202.34 KB 0644
ps_ddl.result File 53.68 KB 0644
ps_ddl1.result File 11.06 KB 0644
ps_grant.result File 3.71 KB 0644
ps_not_windows.result File 516 B 0644
python_with_json.require File 27 B 0644
query_cache.result File 75.57 KB 0644
query_cache_28249.result File 2.29 KB 0644
query_cache_debug.result File 8.63 KB 0644
query_cache_disabled.result File 639 B 0644
query_cache_merge.result File 32.41 KB 0644
query_cache_notembedded.result File 6.61 KB 0644
query_cache_ps_no_prot.result File 11.1 KB 0644
query_cache_ps_ps_prot.result File 11.09 KB 0644
query_cache_size_functionality.result File 6.64 KB 0644
query_cache_type_functionality.result File 6.79 KB 0644
query_cache_with_views.result File 4.96 KB 0644
range_all.result File 81.48 KB 0644
range_icp.result File 81.08 KB 0644
range_icp_mrr.result File 81.42 KB 0644
range_mrr.result File 80.98 KB 0644
range_mrr_cost.result File 80.67 KB 0644
range_none.result File 80.63 KB 0644
read_many_rows_innodb.result File 2.83 KB 0644
read_only.result File 6.3 KB 0644
read_only_innodb.result File 4.76 KB 0644
rename.result File 1.58 KB 0644
renamedb.result File 880 B 0644
repair.result File 7.02 KB 0644
replace.result File 1.09 KB 0644
rewrite_general_log.result File 8.33 KB 0644
rewrite_slow_log.result File 2.92 KB 0644
rollback.result File 582 B 0644
round.result File 6.74 KB 0644
row.result File 15.91 KB 0644
rowid_order_innodb.result File 3.32 KB 0644
rpl_colSize.result File 4.39 KB 0644
rpl_extraColmaster_innodb.result File 23.85 KB 0644
rpl_extraColmaster_myisam.result File 23.85 KB 0644
rpl_mysqldump_slave.result File 867 B 0644
schema.result File 2.37 KB 0644
secure_file_priv_win.result File 1.43 KB 0644
select_all.result File 150.09 KB 0644
select_all_bka.result File 150.86 KB 0644
select_all_bka_nixbnl.result File 150.11 KB 0644
select_found.result File 6.17 KB 0644
select_icp_mrr.result File 150.04 KB 0644
select_icp_mrr_bka.result File 150.8 KB 0644
select_icp_mrr_bka_nixbnl.result File 150.06 KB 0644
select_none.result File 149.37 KB 0644
select_none_bka.result File 149.46 KB 0644
select_none_bka_nixbnl.result File 148.66 KB 0644
select_safe.result File 3.92 KB 0644
server_id.require File 32 B 0644
server_id1.require File 34 B 0644
server_uuid.result File 755 B 0644
server_uuid_embedded.result File 325 B 0644
shm.result File 56.74 KB 0644
show_check.result File 71.33 KB 0644
show_processlist.result File 1.84 KB 0644
show_processlist_state.result File 146 B 0644
show_profile.result File 491 B 0644
signal.result File 63.09 KB 0644
signal_code.result File 1020 B 0644
signal_demo1.result File 6.06 KB 0644
signal_demo2.result File 3.86 KB 0644
signal_demo3.result File 3.33 KB 0644
signal_sqlmode.result File 2.51 KB 0644
single_delete_update.result File 24.41 KB 0644
skip_grants.result File 2.47 KB 0644
skip_log_bin.result File 167 B 0644
skip_name_resolve.result File 1.28 KB 0644
slave-running.result File 71 B 0644
slave-stopped.result File 72 B 0644
sort_buffer_size_functionality.result File 6.48 KB 0644
sp-big.result File 1.47 KB 0644
sp-bugs.result File 7.66 KB 0644
sp-code.result File 28.23 KB 0644
sp-destruct.result File 6.84 KB 0644
sp-dynamic.result File 9.55 KB 0644
sp-error.result File 81.43 KB 0644
sp-fib.result File 656 B 0644
sp-lock.result File 21.45 KB 0644
sp-no-code.result File 307 B 0644
sp-prelocking.result File 7.09 KB 0644
sp-security.result File 23.51 KB 0644
sp-threads.result File 2.01 KB 0644
sp-ucs2.result File 4.78 KB 0644
sp-vars.result File 28.09 KB 0644
sp.result File 183.74 KB 0644
sp_debug.result File 735 B 0644
sp_gis.result File 829 B 0644
sp_notembedded.result File 10 KB 0644
sp_stress_case.result File 2.53 KB 0644
sp_sync.result File 3.17 KB 0644
sp_trans.result File 14.3 KB 0644
sp_trans_log.result File 891 B 0644
sp_validation.result File 34.67 KB 0644
sql_mode.result File 17.53 KB 0644
ssl-big.result File 69 B 0644
ssl-crl-revoked-crl.result File 76 B 0644
ssl-sha512.result File 376 B 0644
ssl.result File 56.89 KB 0644
ssl_8k_key.result File 42 B 0644
ssl_and_innodb.result File 183 B 0644
ssl_ca.result File 857 B 0644
ssl_cipher.result File 254 B 0644
ssl_compress.result File 56.52 KB 0644
ssl_connect.result File 10 B 0644
ssl_crl.result File 1.14 KB 0644
ssl_crl_clients-valid.result File 1.01 KB 0644
ssl_crl_clients.result File 427 B 0644
ssl_crl_clients_valid.result File 620 B 0644
ssl_crl_crlpath.result File 728 B 0644
ssl_mode.result File 1.29 KB 0644
ssl_mode_no_ssl.result File 1.06 KB 0644
ssl_verify_identity.result File 1 KB 0644
status.result File 9.83 KB 0644
status2.result File 1.35 KB 0644
status_bug17954.result File 582 B 0644
status_debug.result File 1.06 KB 0644
strict.result File 64.41 KB 0644
strict_autoinc_1myisam.result File 654 B 0644
strict_autoinc_2innodb.result File 654 B 0644
strict_autoinc_3heap.result File 654 B 0644
subquery_all.result File 258.33 KB 0644
subquery_all_bka.result File 258.65 KB 0644
subquery_all_bka_nixbnl.result File 258.42 KB 0644
subquery_bugs.result File 3.05 KB 0644
subquery_mat.result File 94.96 KB 0644
subquery_mat_all.result File 87.69 KB 0644
subquery_mat_none.result File 89.71 KB 0644
subquery_nomat_nosj.result File 258.39 KB 0644
subquery_nomat_nosj_bka.result File 258.64 KB 0644
subquery_nomat_nosj_bka_nixbnl.result File 258.21 KB 0644
subquery_none.result File 258.29 KB 0644
subquery_none_bka.result File 258.38 KB 0644
subquery_none_bka_nixbnl.result File 257.96 KB 0644
subquery_sj_all.result File 368.6 KB 0644
subquery_sj_all_bka.result File 370.21 KB 0644
subquery_sj_all_bka_nixbnl.result File 359 KB 0644
subquery_sj_all_bkaunique.result File 370.58 KB 0644
subquery_sj_dupsweed.result File 370.17 KB 0644
subquery_sj_dupsweed_bka.result File 370.42 KB 0644
subquery_sj_dupsweed_bka_nixbnl.result File 352.52 KB 0644
subquery_sj_dupsweed_bkaunique.result File 370.45 KB 0644
subquery_sj_firstmatch.result File 363.23 KB 0644
subquery_sj_firstmatch_bka.result File 363.32 KB 0644
subquery_sj_firstmatch_bka_nixbnl.result File 351.28 KB 0644
subquery_sj_firstmatch_bkaunique.result File 363.35 KB 0644
subquery_sj_innodb_all.result File 4.74 KB 0644
subquery_sj_innodb_all_bka.result File 4.93 KB 0644
subquery_sj_innodb_all_bka_nixbnl.result File 4.95 KB 0644
subquery_sj_innodb_all_bkaunique.result File 4.99 KB 0644
subquery_sj_innodb_none.result File 4.62 KB 0644
subquery_sj_innodb_none_bka.result File 4.71 KB 0644
subquery_sj_innodb_none_bka_nixbnl.result File 4.7 KB 0644
subquery_sj_innodb_none_bkaunique.result File 4.75 KB 0644
subquery_sj_loosescan.result File 370.08 KB 0644
subquery_sj_loosescan_bka.result File 370.33 KB 0644
subquery_sj_loosescan_bka_nixbnl.result File 352.5 KB 0644
subquery_sj_loosescan_bkaunique.result File 370.36 KB 0644
subquery_sj_mat.result File 378.77 KB 0644
subquery_sj_mat_bka.result File 378.85 KB 0644
subquery_sj_mat_bka_nixbnl.result File 362.06 KB 0644
subquery_sj_mat_bkaunique.result File 378.88 KB 0644
subquery_sj_mat_nosj.result File 376.23 KB 0644
subquery_sj_none.result File 374.82 KB 0644
subquery_sj_none_bka.result File 374.92 KB 0644
subquery_sj_none_bka_nixbnl.result File 367.91 KB 0644
subquery_sj_none_bkaunique.result File 374.95 KB 0644
subselect_debug.result File 409 B 0644
subselect_gis.result File 305 B 0644
subselect_innodb.result File 28.1 KB 0644
subselect_notembedded.result File 752 B 0644
sum_distinct-big.result File 2 KB 0644
sum_distinct.result File 3.14 KB 0644
symlink.result File 7.75 KB 0644
symlink_windows.result File 321 B 0644
synchronization.result File 4.05 KB 0644
sysdate_is_now.result File 76 B 0644
system_mysql_db.result File 13.5 KB 0644
system_mysql_db_refs.result File 2.96 KB 0644
table_definition_cache_functionality.result File 6.9 KB 0644
table_open_cache_functionality.result File 12.78 KB 0644
tablelock.result File 1.5 KB 0644
tablespace.result File 10.13 KB 0644
temp_pool.result File 538 B 0644
temp_table.result File 7.39 KB 0644
temporal_literal.result File 13.16 KB 0644
testdb_only.require File 45 B 0644
thread_cache_size_functionality.result File 5.26 KB 0644
timezone.result File 1.8 KB 0644
timezone2.result File 11.81 KB 0644
timezone3.result File 2.21 KB 0644
timezone4.result File 148 B 0644
timezone_grant.result File 3.76 KB 0644
trans_read_only.result File 1.03 KB 0644
trigger-compat.result File 7.75 KB 0644
trigger-trans.result File 6.46 KB 0644
trigger.result File 68.46 KB 0644
trigger_notembedded.result File 17.03 KB 0644
true.require File 7 B 0644
truncate.result File 3.58 KB 0644
truncate_coverage.result File 2.4 KB 0644
type_binary.result File 3.62 KB 0644
type_bit.result File 16.92 KB 0644
type_bit_innodb.result File 7.31 KB 0644
type_blob.result File 28.87 KB 0644
type_date.result File 18.46 KB 0644
type_datetime.result File 31.24 KB 0644
type_decimal.result File 36.1 KB 0644
type_enum.result File 101.19 KB 0644
type_float.result File 11.97 KB 0644
type_nchar.result File 1.44 KB 0644
type_newdecimal-big.result File 678 B 0644
type_newdecimal.result File 61.46 KB 0644
type_ranges.result File 17.38 KB 0644
type_set.result File 3.99 KB 0644
type_temporal_fractional.result File 635.43 KB 0644
type_temporal_upgrade.result File 9.9 KB 0644
type_time.result File 109.27 KB 0644
type_timestamp.result File 24.69 KB 0644
type_timestamp_explicit.result File 27.35 KB 0644
type_uint.result File 366 B 0644
type_varchar.result File 16.66 KB 0644
type_year.result File 7.78 KB 0644
udf.result File 16.03 KB 0644
udf_services.result File 499 B 0644
udf_skip_grants.result File 223 B 0644
union.result File 52.6 KB 0644
unsafe_binlog_innodb.result File 4.36 KB 0644
update.result File 16.63 KB 0644
upgrade.result File 4.91 KB 0644
user_limits.result File 3.54 KB 0644
user_var-binlog.result File 2.17 KB 0644
user_var.result File 15.34 KB 0644
validate_password_plugin.result File 12.09 KB 0644
varbinary.result File 3.34 KB 0644
variables-big.result File 972 B 0644
variables-notembedded.result File 5.78 KB 0644
variables-win.result File 347 B 0644
variables.result File 61.67 KB 0644
variables_community.result File 182 B 0644
variables_debug.result File 2.13 KB 0644
view.result File 178.72 KB 0644
view_alias.result File 6.19 KB 0644
view_grant.result File 76.69 KB 0644
wait_timeout.result File 1.07 KB 0644
warnings.result File 11.21 KB 0644
warnings_engine_disabled.result File 475 B 0644
windows.require File 7 B 0644
windows.result File 1.86 KB 0644
wl6219-csv.result File 7.23 KB 0644
wl6219-innodb.result File 7.27 KB 0644
wl6219-memory.result File 7.27 KB 0644
wl6219-merge.result File 5.99 KB 0644
wl6219-myisam.result File 7.27 KB 0644
wl6219-upgrade.result File 7.33 KB 0644
wl6301_1_not_windows.result File 44 B 0644
wl6301_2_not_windows.result File 46 B 0644
wl6301_3.result File 89 B 0644
wl6443_deprecation.result File 10.71 KB 0644
xa.result File 7.13 KB 0644
xml.result File 41.78 KB 0644