~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/myisam_mrr.result

  • Committer: Monty Taylor
  • Date: 2008-09-15 17:24:04 UTC
  • Revision ID: monty@inaugust.com-20080915172404-ygh6hiyu0q7qpa9x
Removed strndup calls.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
drop table if exists t1, t2, t3;
2
 
set @read_rnd_buffer_size_save= @@read_rnd_buffer_size;
3
 
set read_rnd_buffer_size=79;
4
 
select @@read_rnd_buffer_size;
5
 
@@read_rnd_buffer_size
6
 
79
7
 
create table t1(a int);
8
 
show create table t1;
9
 
Table   Create Table
10
 
t1      CREATE TABLE `t1` (
11
 
  `a` int
12
 
) ENGINE=InnoDB
13
 
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
14
 
create table t2(a int);
15
 
insert into t2 select A.a + 10*(B.a + 10*C.a) from t1 A, t1 B, t1 C;
16
 
create table t3 (
17
 
a char(8) not null, b char(8) not null, filler char(200),
18
 
key(a)
19
 
);
20
 
insert into t3 select @a:=concat('c-', 1000+ A.a, '=w'), @a, 'filler' from t2 A;
21
 
insert into t3 select concat('c-', 1000+A.a, '=w'), concat('c-', 2000+A.a, '=w'), 
22
 
'filler-1' from t2 A;
23
 
insert into t3 select concat('c-', 1000+A.a, '=w'), concat('c-', 3000+A.a, '=w'), 
24
 
'filler-2' from t2 A;
25
 
select a,filler from t3 where a >= 'c-9011=w';
26
 
a       filler
27
 
select a,filler from t3 where a >= 'c-1011=w' and a <= 'c-1015=w';
28
 
a       filler
29
 
c-1011=w        filler
30
 
c-1012=w        filler
31
 
c-1011=w        filler-1
32
 
c-1012=w        filler-1
33
 
c-1011=w        filler-2
34
 
c-1012=w        filler-2
35
 
c-1013=w        filler
36
 
c-1014=w        filler
37
 
c-1013=w        filler-1
38
 
c-1014=w        filler-1
39
 
c-1013=w        filler-2
40
 
c-1014=w        filler-2
41
 
c-1015=w        filler
42
 
c-1015=w        filler-1
43
 
c-1015=w        filler-2
44
 
select a,filler from t3 where (a>='c-1011=w' and a <= 'c-1013=w') or
45
 
(a>='c-1014=w' and a <= 'c-1015=w');
46
 
a       filler
47
 
c-1011=w        filler
48
 
c-1012=w        filler
49
 
c-1011=w        filler-1
50
 
c-1012=w        filler-1
51
 
c-1011=w        filler-2
52
 
c-1012=w        filler-2
53
 
c-1013=w        filler
54
 
c-1014=w        filler
55
 
c-1013=w        filler-1
56
 
c-1014=w        filler-1
57
 
c-1013=w        filler-2
58
 
c-1014=w        filler-2
59
 
c-1015=w        filler
60
 
c-1015=w        filler-1
61
 
c-1015=w        filler-2
62
 
insert into t3 values ('c-1013=z', 'c-1013=z', 'err');
63
 
insert into t3 values ('a-1014=w', 'a-1014=w', 'err');
64
 
select a,filler from t3 where (a>='c-1011=w' and a <= 'c-1013=w') or
65
 
(a>='c-1014=w' and a <= 'c-1015=w');
66
 
a       filler
67
 
c-1011=w        filler
68
 
c-1012=w        filler
69
 
c-1011=w        filler-1
70
 
c-1012=w        filler-1
71
 
c-1011=w        filler-2
72
 
c-1012=w        filler-2
73
 
c-1013=w        filler
74
 
c-1014=w        filler
75
 
c-1013=w        filler-1
76
 
c-1014=w        filler-1
77
 
c-1013=w        filler-2
78
 
c-1014=w        filler-2
79
 
c-1015=w        filler
80
 
c-1015=w        filler-1
81
 
c-1015=w        filler-2
82
 
delete from t3 where b in ('c-1013=z', 'a-1014=w');
83
 
select a,filler from t3 where a='c-1011=w' or a='c-1012=w' or a='c-1013=w' or
84
 
a='c-1014=w' or a='c-1015=w';
85
 
a       filler
86
 
c-1011=w        filler
87
 
c-1012=w        filler
88
 
c-1011=w        filler-1
89
 
c-1012=w        filler-1
90
 
c-1011=w        filler-2
91
 
c-1012=w        filler-2
92
 
c-1013=w        filler
93
 
c-1014=w        filler
94
 
c-1013=w        filler-1
95
 
c-1014=w        filler-1
96
 
c-1013=w        filler-2
97
 
c-1014=w        filler-2
98
 
c-1015=w        filler
99
 
c-1015=w        filler-1
100
 
c-1015=w        filler-2
101
 
insert into t3 values ('c-1013=w', 'del-me', 'inserted');
102
 
select a,filler from t3 where a='c-1011=w' or a='c-1012=w' or a='c-1013=w' or
103
 
a='c-1014=w' or a='c-1015=w';
104
 
a       filler
105
 
c-1011=w        filler
106
 
c-1012=w        filler
107
 
c-1011=w        filler-1
108
 
c-1012=w        filler-1
109
 
c-1011=w        filler-2
110
 
c-1012=w        filler-2
111
 
c-1013=w        filler
112
 
c-1014=w        filler
113
 
c-1013=w        filler-1
114
 
c-1014=w        filler-1
115
 
c-1013=w        filler-2
116
 
c-1013=w        inserted
117
 
c-1015=w        filler
118
 
c-1015=w        filler-1
119
 
c-1014=w        filler-2
120
 
c-1015=w        filler-2
121
 
delete from t3 where b='del-me';
122
 
alter table t3 add primary key(b);
123
 
select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1018=w') or 
124
 
b IN ('c-1019=w', 'c-1020=w', 'c-1021=w', 
125
 
'c-1022=w', 'c-1023=w', 'c-1024=w');
126
 
b       filler
127
 
c-1011=w        filler
128
 
c-1012=w        filler
129
 
c-1013=w        filler
130
 
c-1014=w        filler
131
 
c-1015=w        filler
132
 
c-1016=w        filler
133
 
c-1017=w        filler
134
 
c-1018=w        filler
135
 
c-1019=w        filler
136
 
c-1020=w        filler
137
 
c-1021=w        filler
138
 
c-1022=w        filler
139
 
c-1023=w        filler
140
 
c-1024=w        filler
141
 
select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1020=w') or 
142
 
b IN ('c-1021=w', 'c-1022=w', 'c-1023=w');
143
 
b       filler
144
 
c-1011=w        filler
145
 
c-1012=w        filler
146
 
c-1013=w        filler
147
 
c-1014=w        filler
148
 
c-1015=w        filler
149
 
c-1016=w        filler
150
 
c-1017=w        filler
151
 
c-1018=w        filler
152
 
c-1019=w        filler
153
 
c-1020=w        filler
154
 
c-1021=w        filler
155
 
c-1022=w        filler
156
 
c-1023=w        filler
157
 
select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1018=w') or 
158
 
b IN ('c-1019=w', 'c-1020=w') or 
159
 
(b>='c-1021=w' and b<= 'c-1023=w');
160
 
b       filler
161
 
c-1011=w        filler
162
 
c-1012=w        filler
163
 
c-1013=w        filler
164
 
c-1014=w        filler
165
 
c-1015=w        filler
166
 
c-1016=w        filler
167
 
c-1017=w        filler
168
 
c-1018=w        filler
169
 
c-1019=w        filler
170
 
c-1020=w        filler
171
 
c-1021=w        filler
172
 
c-1022=w        filler
173
 
c-1023=w        filler
174
 
create table t4 (a varchar(10), b int, c char(10), filler char(200),
175
 
key idx1 (a, b, c));
176
 
insert into t4 (filler) select concat('NULL-', 15-a) from t2 order by a limit 15;
177
 
insert into t4 (a,b,c,filler) 
178
 
select 'b-1',NULL,'c-1', concat('NULL-', 15-a) from t2 order by a limit 15;
179
 
insert into t4 (a,b,c,filler) 
180
 
select 'b-1',NULL,'c-222', concat('NULL-', 15-a) from t2 order by a limit 15;
181
 
insert into t4 (a,b,c,filler) 
182
 
select 'bb-1',NULL,'cc-2', concat('NULL-', 15-a) from t2 order by a limit 15;
183
 
insert into t4 (a,b,c,filler) 
184
 
select 'zz-1',NULL,'cc-2', 'filler-data' from t2 order by a limit 500;
185
 
explain 
186
 
select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1'
187
 
                                                      or c='no-such-row2');
188
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
189
 
1       SIMPLE  t4      range   idx1    idx1    91      NULL    16      Using where; Using MRR
190
 
select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1'
191
 
                                                    or c='no-such-row2');
192
 
a       b       c       filler
193
 
explain 
194
 
select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2');
195
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
196
 
1       SIMPLE  t4      ALL     idx1    NULL    NULL    NULL    178     Using where
197
 
select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2');
198
 
a       b       c       filler
199
 
b-1     NULL    c-1     NULL-15
200
 
b-1     NULL    c-1     NULL-14
201
 
b-1     NULL    c-1     NULL-13
202
 
b-1     NULL    c-1     NULL-12
203
 
b-1     NULL    c-1     NULL-11
204
 
b-1     NULL    c-1     NULL-10
205
 
b-1     NULL    c-1     NULL-9
206
 
b-1     NULL    c-1     NULL-8
207
 
b-1     NULL    c-1     NULL-7
208
 
b-1     NULL    c-1     NULL-6
209
 
b-1     NULL    c-1     NULL-5
210
 
b-1     NULL    c-1     NULL-4
211
 
b-1     NULL    c-1     NULL-3
212
 
b-1     NULL    c-1     NULL-2
213
 
b-1     NULL    c-1     NULL-1
214
 
bb-1    NULL    cc-2    NULL-15
215
 
bb-1    NULL    cc-2    NULL-14
216
 
bb-1    NULL    cc-2    NULL-13
217
 
bb-1    NULL    cc-2    NULL-12
218
 
bb-1    NULL    cc-2    NULL-11
219
 
bb-1    NULL    cc-2    NULL-10
220
 
bb-1    NULL    cc-2    NULL-9
221
 
bb-1    NULL    cc-2    NULL-8
222
 
bb-1    NULL    cc-2    NULL-7
223
 
bb-1    NULL    cc-2    NULL-6
224
 
bb-1    NULL    cc-2    NULL-5
225
 
bb-1    NULL    cc-2    NULL-4
226
 
bb-1    NULL    cc-2    NULL-3
227
 
bb-1    NULL    cc-2    NULL-2
228
 
bb-1    NULL    cc-2    NULL-1
229
 
select * from t4 ignore index(idx1) where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2');
230
 
a       b       c       filler
231
 
b-1     NULL    c-1     NULL-15
232
 
b-1     NULL    c-1     NULL-14
233
 
b-1     NULL    c-1     NULL-13
234
 
b-1     NULL    c-1     NULL-12
235
 
b-1     NULL    c-1     NULL-11
236
 
b-1     NULL    c-1     NULL-10
237
 
b-1     NULL    c-1     NULL-9
238
 
b-1     NULL    c-1     NULL-8
239
 
b-1     NULL    c-1     NULL-7
240
 
b-1     NULL    c-1     NULL-6
241
 
b-1     NULL    c-1     NULL-5
242
 
b-1     NULL    c-1     NULL-4
243
 
b-1     NULL    c-1     NULL-3
244
 
b-1     NULL    c-1     NULL-2
245
 
b-1     NULL    c-1     NULL-1
246
 
bb-1    NULL    cc-2    NULL-15
247
 
bb-1    NULL    cc-2    NULL-14
248
 
bb-1    NULL    cc-2    NULL-13
249
 
bb-1    NULL    cc-2    NULL-12
250
 
bb-1    NULL    cc-2    NULL-11
251
 
bb-1    NULL    cc-2    NULL-10
252
 
bb-1    NULL    cc-2    NULL-9
253
 
bb-1    NULL    cc-2    NULL-8
254
 
bb-1    NULL    cc-2    NULL-7
255
 
bb-1    NULL    cc-2    NULL-6
256
 
bb-1    NULL    cc-2    NULL-5
257
 
bb-1    NULL    cc-2    NULL-4
258
 
bb-1    NULL    cc-2    NULL-3
259
 
bb-1    NULL    cc-2    NULL-2
260
 
bb-1    NULL    cc-2    NULL-1
261
 
set @@read_rnd_buffer_size= @read_rnd_buffer_size_save;
262
 
drop table t1, t2, t3, t4;
263
 
CREATE TABLE t1 (
264
 
ID int NOT NULL AUTO_INCREMENT,
265
 
col1 int DEFAULT NULL,
266
 
key1 int NOT NULL DEFAULT '0',
267
 
key2 int DEFAULT NULL,
268
 
text1 text,
269
 
text2 text,
270
 
col2 int DEFAULT '100',
271
 
col3 enum('headers','bodyandsubject') NOT NULL DEFAULT 'bodyandsubject',
272
 
col4 int NOT NULL DEFAULT '0',
273
 
PRIMARY KEY (ID),
274
 
KEY (key1),
275
 
KEY (key2)
276
 
) ENGINE=MyISAM AUTO_INCREMENT=6;
277
 
INSERT INTO t1 VALUES
278
 
(1,NULL,1130,NULL,'Hello',NULL,100,'bodyandsubject',0),
279
 
(2,NULL,1130,NULL,'bye',NULL,100,'bodyandsubject',0),
280
 
(3,NULL,1130,NULL,'red',NULL,100,'bodyandsubject',0),
281
 
(4,NULL,1130,NULL,'yellow',NULL,100,'bodyandsubject',0),
282
 
(5,NULL,1130,NULL,'blue',NULL,100,'bodyandsubject',0);
283
 
select * FROM t1 WHERE key1=1130 AND col1 IS NULL ORDER BY text1;
284
 
ID      col1    key1    key2    text1   text2   col2    col3    col4
285
 
5       NULL    1130    NULL    blue    NULL    100     bodyandsubject  0
286
 
2       NULL    1130    NULL    bye     NULL    100     bodyandsubject  0
287
 
1       NULL    1130    NULL    Hello   NULL    100     bodyandsubject  0
288
 
3       NULL    1130    NULL    red     NULL    100     bodyandsubject  0
289
 
4       NULL    1130    NULL    yellow  NULL    100     bodyandsubject  0
290
 
drop table t1;