1# include/index_merge1.inc
2#
3# Index merge tests
4#
5# The variable
6#     $merge_table_support -- 1 storage engine supports merge tables
7#                          -- 0 storage engine does not support merge tables
8# has to be set before sourcing this script.
9#
10# Note: The comments/expectations refer to MyISAM.
11#       They might be not valid for other storage engines.
12#
13# Last update:
14# 2006-08-02 ML test refactored
15#               old name was t/index_merge.test
16#               main code went into include/index_merge1.inc
17#
18--source include/have_sequence.inc
19
20--echo #---------------- Index merge test 1 -------------------------------------------
21
22# Create and fill a table with simple keys
23create table t0
24(
25  key1 int not null,
26  INDEX i1(key1)
27);
28
29insert into t0(key1) select seq from seq_1_to_1024;
30
31alter table t0 add key2 int not null, add index i2(key2);
32alter table t0 add key3 int not null, add index i3(key3);
33alter table t0 add key4 int not null, add index i4(key4);
34alter table t0 add key5 int not null, add index i5(key5);
35alter table t0 add key6 int not null, add index i6(key6);
36alter table t0 add key7 int not null, add index i7(key7);
37alter table t0 add key8 int not null, add index i8(key8);
38
39update t0 set key2=key1,key3=key1,key4=key1,key5=key1,key6=key1,key7=key1,key8=1024-key1;
40analyze table t0;
41
42# 1. One index
43explain select * from t0 where key1 < 3 or key1 > 920 and key1 < 924;
44
45# 2. Simple cases
46explain
47select * from t0 where key1 < 3 or key2 > 920 and key2 < 924;
48select * from t0 where key1 < 3 or key2 > 920 and key2 < 924;
49
50select * from t0 where key1=1022; # MDEV-13535 no-key-read select after keyread
51
52explain select * from t0 where key1 < 3 or key2 <4;
53
54explain
55select * from t0 where (key1 > 30 and key1<35) or (key2 >32 and key2 < 40);
56# Bug#21277: InnoDB, wrong result set, index_merge strategy, second index not evaluated
57select * from t0 where (key1 > 30 and key1<35) or (key2 >32 and key2 < 40);
58
59# 3. Check that index_merge doesn't break "ignore/force/use index"
60explain select * from t0 ignore index (i2) where key1 < 3 or key2 <4;
61explain select * from t0 where (key1 < 3 or key2 <4) and key3 = 50;
62explain select * from t0 use index (i1,i2) where (key1 < 3 or key2 <4) and key3 = 50;
63
64explain select * from t0 where (key1 > 1 or key2  > 2);
65explain select * from t0 force index (i1,i2) where (key1 > 1 or key2  > 2);
66
67
68# 4. Check if conjuncts are grouped by keyuse
69explain
70  select * from t0 where key1<3 or key2<3 or (key1>5 and key1<8) or
71  (key1>10 and key1<12) or (key2>100 and key2<110);
72
73# 5. Check index_merge with conjuncts that are always true/false
74#    verify fallback to "range" if there is only one non-confluent condition
75explain select * from t0 where key2 = 45 or key1 <=> null;
76
77explain select * from t0 where key2 = 45 or key1 is not null;
78explain select * from t0 where key2 = 45 or key1 is null;
79
80#   the last conj. is always false and will be discarded
81explain select * from t0 where key2=10 or key3=3 or key4 <=> null;
82
83#   the last conj. is always true and will cause 'all' scan
84explain select * from t0 where key2=10 or key3=3 or key4 is null;
85
86#   some more complicated cases
87explain select key1 from t0 where (key1 <=> null) or (key2 < 5) or
88                                   (key3=10) or (key4 <=> null);
89explain select key1 from t0 where (key1 <=> null) or (key1 < 5) or
90                                   (key3=10) or (key4 <=> null);
91
92# 6.Several ways to do index_merge, (ignored) index_merge vs. range
93explain select * from t0 where
94  (key1 < 3 or key2 < 3) and (key3 < 4 or key4 < 4) and (key5 < 5 or key6 < 5);
95
96explain
97select * from t0 where (key1 < 3 or key2 < 6) and (key1 < 7 or key3 < 4);
98
99select * from t0 where (key1 < 3 or key2 < 6) and (key1 < 7 or key3 < 4);
100
101explain select * from t0 where
102  (key1 < 3 or key2 < 3) and (key3 < 4 or key4 < 4) and (key5 < 2 or key6 < 2);
103
104#   now index_merge is not used at all when "range" is possible
105explain select * from t0 where
106  (key1 < 3 or key2 < 3) and (key3 < 100);
107
108#   this even can cause "all" scan:
109explain select * from t0 where
110  (key1 < 3 or key2 < 3) and (key3 < 1000);
111
112
113# 7. Complex cases
114#   tree_or(List<SEL_IMERGE>, range SEL_TREE).
115explain select * from t0 where
116    ((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
117  or
118    key2 > 5;
119
120explain select * from t0 where
121    ((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
122  or
123    key1 < 7;
124
125select * from t0 where
126    ((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4))
127  or
128    key1 < 7;
129
130#   tree_or(List<SEL_IMERGE>, List<SEL_IMERGE>).
131select count(*) from t0 where
132    ((key1 < 4 or key2 < 4) and (key3 <5 or key5 < 4))
133  or
134    ((key5 < 5 or key6 < 6) and (key7 <7 or key8 < 4));
135explain select * from t0 where
136    ((key1 < 4 or key2 < 4) and (key3 <5 or key5 < 4))
137  or
138    ((key5 < 5 or key6 < 6) and (key7 <7 or key8 < 4));
139
140explain select * from t0 where
141    ((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
142  or
143    ((key7 <7 or key8 < 4) and (key5 < 5 or key6 < 6));
144
145explain select * from t0 where
146    ((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
147  or
148    ((key3 <7 or key5 < 2) and (key5 < 5 or key6 < 6));
149
150explain select * from t0 where
151    ((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4))
152  or
153    (((key3 <7 and key7 < 6) or key5 < 2) and (key5 < 5 or key6 < 6));
154
155explain select * from t0 where
156    ((key3 < 4 or key5 < 4) and (key1 < 4 or key2 < 4))
157  or
158    ((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
159
160explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where
161    ((key3 < 4 or key5 < 4) and (key1 < 4 or key2 < 4))
162  or
163    ((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
164
165explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where
166    ((key3 < 5 or key5 < 4) and (key1 < 4 or key2 < 4))
167  or
168    ((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
169
170explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where
171    ((key3 < 10 or key5 < 4) and (key1 < 4 or key2 < 4))
172  or
173    ((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6));
174
175# 8. Verify that "order by" after index merge uses filesort
176select * from t0 where key1 < 5 or key8 < 4 order by key1;
177
178explain
179select * from t0 where key1 < 5 or key8 < 4 order by key1;
180
181# 9. Check that index_merge cost is compared to 'index' where possible
182create table t2 like t0;
183insert into t2 select * from t0;
184
185alter table t2 add index i1_3(key1, key3);
186alter table t2 add index i2_3(key2, key3);
187alter table t2 drop index i1;
188alter table t2 drop index i2;
189alter table t2 add index i321(key3, key2, key1);
190
191#   index_merge vs 'index', index_merge is better.
192explain select key3 from t2 where key1 = 100 or key2 = 100;
193
194#   index_merge vs 'index', 'index' is better.
195explain select key3 from t2 where key1 < 500 or key2 < 500;
196
197#   index_merge vs 'all', index_merge is better.
198explain select key7 from t2 where key1 <100 or key2 < 100;
199
200# 10. Multipart keys.
201create table t4 (
202  key1a int not null,
203  key1b int not null,
204  key2  int not null,
205  key2_1 int not null,
206  key2_2 int not null,
207  key3  int not null,
208  index i1a (key1a, key1b),
209  index i1b (key1b, key1a),
210  index i2_1(key2, key2_1),
211  index i2_2(key2, key2_1)
212);
213
214insert into t4 select seq,seq,seq div 10, seq % 10, seq % 10, seq from seq_1_to_1024;
215
216#   the following will be handled by index_merge:
217select * from t4 where key1a = 3 or key1b = 4;
218explain select * from t4 where key1a = 3 or key1b = 4;
219
220#   and the following will not
221explain select * from t4 where key2 = 1 and (key2_1 = 1 or key3 = 5);
222
223explain select * from t4 where key2 = 1 and (key2_1 = 1 or key2_2 = 5);
224
225explain select * from t4 where key2_1 = 1 or key2_2 = 5;
226
227
228# 11. Multitable selects
229create table t1 like t0;
230insert into t1 select * from t0;
231
232#  index_merge on first table in join
233explain select * from t0 left join t1 on (t0.key1=t1.key1)
234  where t0.key1=3 or t0.key2=4;
235
236select * from t0 left join t1 on (t0.key1=t1.key1)
237  where t0.key1=3 or t0.key2=4;
238
239explain
240select * from t0,t1 where (t0.key1=t1.key1) and ( t0.key1=3 or t0.key2=4);
241
242#  index_merge vs. ref
243explain
244select * from t0,t1 where (t0.key1=t1.key1) and
245  (t0.key1=3 or t0.key2=4) and t1.key1<200;
246
247#  index_merge vs. ref
248explain
249select * from t0,t1 where (t0.key1=t1.key1) and
250  (t0.key1=3 or t0.key2<4) and t1.key1=2;
251
252#  index_merge on second table in join
253explain select * from t0,t1 where t0.key1 = 5 and
254  (t1.key1 = t0.key1 or t1.key8 = t0.key1);
255
256# Fix for bug#1974
257explain select * from t0,t1 where t0.key1 < 3 and
258  (t1.key1 = t0.key1 or t1.key8 = t0.key1);
259
260#  index_merge inside union
261explain select * from t1 where key1=3 or key2=4
262  union select * from t1 where key1<4 or key3=5;
263
264#  index merge in subselect
265set @tmp_optimizer_switch=@@optimizer_switch;
266set optimizer_switch='derived_merge=off,derived_with_keys=off';
267explain select * from (select * from t1 where key1 = 3 or key2 =3) as Z where key8 >5;
268set optimizer_switch=@tmp_optimizer_switch;
269
270# 12. check for long index_merges.
271create table t3 like t0;
272insert into t3 select * from t0;
273alter table t3 add key9 int not null, add index i9(key9);
274alter table t3 add keyA int not null, add index iA(keyA);
275alter table t3 add keyB int not null, add index iB(keyB);
276alter table t3 add keyC int not null, add index iC(keyC);
277update t3 set key9=key1,keyA=key1,keyB=key1,keyC=key1;
278
279explain select * from t3 where
280  key1=1 or key2=2 or key3=3 or key4=4 or
281  key5=5 or key6=6 or key7=7 or key8=8 or
282  key9=9 or keyA=10 or keyB=11 or keyC=12;
283
284select * from t3 where
285  key1=1 or key2=2 or key3=3 or key4=4 or
286  key5=5 or key6=6 or key7=7 or key8=8 or
287  key9=9 or keyA=10 or keyB=11 or keyC=12;
288
289# Test for Bug#3183
290explain select * from t0 where key1 < 3 or key2 < 4;
291# Bug#21277: InnoDB, wrong result set, index_merge strategy, second index not evaluated
292select * from t0 where key1 < 3 or key2 < 4;
293
294update t0 set key8=123 where key1 < 3 or key2 < 4;
295# Bug#21277: InnoDB, wrong result set, index_merge strategy, second index not evaluated
296select * from t0 where key1 < 3 or key2 < 4;
297
298delete from t0 where key1 < 3 or key2 < 4;
299select * from t0 where key1 < 3 or key2 < 4;
300select count(*) from t0;
301
302# Test for BUG#4177
303drop table t4;
304create table t4 (a int);
305insert into t4 values (1),(4),(3);
306set @save_join_buffer_size=@@join_buffer_size;
307set join_buffer_size= 4096;
308explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
309 from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
310  where (A.key1 < 500000 or A.key2 < 3)
311  and   (B.key1 < 500000 or B.key2 < 3);
312
313select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
314 from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
315  where (A.key1 < 500000 or A.key2 < 3)
316  and   (B.key1 < 500000 or B.key2 < 3);
317
318update t0 set key1=1;
319explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
320 from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
321  where (A.key1 = 1 or A.key2 = 1)
322  and   (B.key1 = 1 or B.key2 = 1);
323
324select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
325 from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
326  where (A.key1 = 1 or A.key2 = 1)
327  and   (B.key1 = 1 or B.key2 = 1);
328
329alter table t0 add filler1 char(200), add filler2 char(200), add filler3 char(200);
330update t0 set key2=1, key3=1, key4=1, key5=1,key6=1,key7=1 where key7 < 500;
331
332# The next query will not use index i7 in intersection if the OS doesn't
333# support file sizes > 2GB. (ha_myisam::ref_length depends on this and index
334# scan cost estimates depend on ha_myisam::ref_length)
335--replace_column 9 #
336--replace_result "4,4,4,4,4,4,4" X "4,4,4,4,4,4" X "i6,i7" "i6,i7?" "i6" "i6,i7?"
337explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
338 from t0 as A straight_join t0 as B
339 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)
340  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);
341
342select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
343 from t0 as A straight_join t0 as B
344 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)
345  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);
346
347set join_buffer_size= @save_join_buffer_size;
348# Test for BUG#4177 ends
349
350drop table t0, t1, t2, t3, t4;
351
352# BUG#16166
353CREATE TABLE t1 (
354  cola char(3) not null, colb char(3) not null,  filler char(200),
355  key(cola), key(colb)
356);
357INSERT INTO t1 VALUES ('foo','bar', 'ZZ'),('fuz','baz', 'ZZ');
358
359--disable_query_log
360let $1=9;
361begin;
362while ($1)
363{
364  eval INSERT INTO t1 SELECT * from t1 WHERE cola = 'foo';
365  dec $1;
366}
367
368let $1=13;
369while ($1)
370{
371  eval INSERT INTO t1 SELECT * from t1 WHERE cola <> 'foo';
372  dec $1;
373}
374commit;
375
376--enable_query_log
377
378OPTIMIZE TABLE t1;
379select count(*) from t1;
380explain select * from t1 WHERE cola = 'foo' AND colb = 'bar';
381explain select * from t1 force index(cola,colb) WHERE cola = 'foo' AND colb = 'bar';
382drop table t1;
383
384if ($merge_table_support)
385{
386#
387# BUG#17314: Index_merge/intersection not choosen by the optimizer for MERGE tables
388#
389create table t1 (
390  a int, b int,
391  filler1 char(200), filler2 char(200),
392  key(a),key(b)
393);
394insert into t1 select @v:= seq % 10, @v, 't1', 'filler2' from seq_1_to_1000;
395
396create table t2 like t1;
397
398create table t3 (
399  a int, b int,
400  filler1 char(200), filler2 char(200),
401  key(a),key(b)
402) engine=merge union=(t1,t2);
403
404--replace_column 9 #
405explain select * from t1 where a=1 and b=1;
406--replace_column 9 #
407explain select * from t3 where a=1 and b=1;
408
409drop table t1, t2, t3;
410}
411
412#
413# BUG#20256 - LOCK WRITE - MyISAM
414#
415CREATE TABLE t1(a INT);
416INSERT INTO t1 VALUES(1);
417CREATE TABLE t2(a INT, b INT, dummy CHAR(16) DEFAULT '', KEY(a), KEY(b));
418INSERT INTO t2(a,b) VALUES
419(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
420(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
421(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
422(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
423(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
424(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
425(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
426(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
427(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
428(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
429(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
430(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
431(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
432(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
433(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
434(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
435(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
436(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
437(1,2);
438LOCK TABLES t1 WRITE, t2 WRITE;
439INSERT INTO t2(a,b) VALUES(1,2);
440SELECT t2.a FROM t1,t2 WHERE t2.b=2 AND t2.a=1;
441UNLOCK TABLES;
442DROP TABLE t1, t2;
443
444#
445# BUG#29740: HA_KEY_SCAN_NOT_ROR wasn't set for HEAP engine
446#
447CREATE TABLE `t1` (
448  `a` int(11) DEFAULT NULL,
449  `filler` char(200) DEFAULT NULL,
450  `b` int(11) DEFAULT NULL,
451  KEY `a` (`a`),
452  KEY `b` (`b`)
453) ENGINE=MEMORY DEFAULT CHARSET=latin1;
454
455insert into t1 values
456(0, 'filler', 0), (1, 'filler', 1), (2, 'filler', 2), (3, 'filler', 3),
457(4, 'filler', 4), (5, 'filler', 5), (6, 'filler', 6), (7, 'filler', 7),
458(8, 'filler', 8), (9, 'filler', 9), (0, 'filler', 0), (1, 'filler', 1),
459(2, 'filler', 2), (3, 'filler', 3), (4, 'filler', 4), (5, 'filler', 5),
460(6, 'filler', 6), (7, 'filler', 7), (8, 'filler', 8), (9, 'filler', 9),
461(10, 'filler', 10), (11, 'filler', 11), (12, 'filler', 12), (13, 'filler', 13),
462(14, 'filler', 14), (15, 'filler', 15), (16, 'filler', 16), (17, 'filler', 17),
463(18, 'filler', 18), (19, 'filler', 19), (4, '5      ', 0), (5, '4      ', 0),
464(4, '4      ', 0), (4, 'qq     ', 5), (5, 'qq     ', 4), (4, 'zz     ', 4);
465
466create table t2(
467  `a` int(11) DEFAULT NULL,
468  `filler` char(200) DEFAULT NULL,
469  `b` int(11) DEFAULT NULL,
470  KEY USING BTREE (`a`),
471  KEY USING BTREE (`b`)
472) ENGINE=MEMORY DEFAULT CHARSET=latin1;
473insert into t2 select * from t1;
474
475
476--echo must use sort-union rather than union:
477--replace_column 9 #
478explain select * from t1 where a=4 or b=4;
479--sorted_result
480select * from t1 where a=4 or b=4;
481--sorted_result
482select * from t1 ignore index(a,b) where a=4 or b=4;
483
484--echo must use union, not sort-union:
485--replace_column 9 #
486explain select * from t2 where a=2 or b=2;
487--sorted_result
488select * from t2 where a=2 or b=2;
489
490drop table t1, t2;
491
492#
493# Bug #37943: Reproducible mysqld crash/sigsegv in sel_trees_can_be_ored
494#
495
496CREATE TABLE t1 (a varchar(8), b set('a','b','c','d','e','f','g','h'),
497                 KEY b(b), KEY a(a));
498INSERT INTO t1 VALUES ('y',''), ('z','');
499
500#should not crash
501SELECT b,a from t1 WHERE (b!='c' AND b!='f' && b!='h') OR
502  (a='pure-S') OR (a='DE80337a') OR (a='DE80799');
503
504DROP TABLE t1;
505
506--echo #
507--echo # BUG#40974: Incorrect query results when using clause evaluated using range check
508--echo #
509create table t1 (a int);
510insert into t1 values (1),(2);
511create table t2(a int, b int);
512insert into t2 values (1,1), (2, 1000);
513create table t3 (a int, b int, filler char(100), key(a), key(b));
514
515insert into t3 select 1000, 1000,'filler' from seq_1_to_1000;
516insert into t3 values (1,1,'data');
517insert into t3 values (1,1,'data');
518-- echo The plan should be ALL/ALL/ALL(Range checked for each record (index map: 0x3)
519explain select * from t1
520where exists (select 1 from t2, t3
521              where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1));
522
523select * from t1
524where exists (select 1 from t2, t3
525              where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1));
526
527drop table t1, t2, t3;
528
529--echo #
530--echo # BUG#44810: index merge and order by with low sort_buffer_size
531--echo # crashes server!
532--echo #
533CREATE TABLE t1(a VARCHAR(128),b VARCHAR(128),KEY(A),KEY(B));
534INSERT INTO t1 SELECT REPEAT('a',128),REPEAT('b',128) FROM seq_1_to_64;
535SET SESSION sort_buffer_size=1024*8;
536EXPLAIN
537SELECT * FROM t1 FORCE INDEX(a,b) WHERE a LIKE 'a%' OR b LIKE 'b%'
538  ORDER BY a,b;
539# we don't actually care about the result : we're checking if it crashes
540--disable_result_log
541SELECT * FROM t1 FORCE INDEX(a,b) WHERE a LIKE 'a%' OR b LIKE 'b%'
542  ORDER BY a,b;
543--enable_result_log
544
545SET SESSION sort_buffer_size=DEFAULT;
546DROP TABLE t1;
547
548
549--echo End of 5.0 tests
550