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