ndb_condition_pushdown.result 54.5 KB
Newer Older
1
DROP TABLE IF EXISTS t1,t2;
mskold@mysql.com's avatar
mskold@mysql.com committed
2 3
CREATE TABLE t1 (
auto int(5) unsigned NOT NULL auto_increment,
4 5
string char(10),
vstring varchar(10),
6
bin binary(2),
7
vbin varbinary(7),	
mskold@mysql.com's avatar
mskold@mysql.com committed
8 9 10 11 12 13 14
tiny tinyint(4) DEFAULT '0' NOT NULL ,
short smallint(6) DEFAULT '1' NOT NULL ,
medium mediumint(8) DEFAULT '0' NOT NULL,
long_int int(11) DEFAULT '0' NOT NULL,
longlong bigint(13) DEFAULT '0' NOT NULL,
real_float float(13,1) DEFAULT 0.0 NOT NULL,
real_double double(16,4),
15
real_decimal decimal(16,4),
mskold@mysql.com's avatar
mskold@mysql.com committed
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
ulong int(11) unsigned DEFAULT '0' NOT NULL,
ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
bits bit(3),
options enum('zero','one','two','three','four') not null,
flags set('zero','one','two','three','four') not null,
date_field date,
year_field year,
time_field time,      
date_time datetime,
time_stamp timestamp,
PRIMARY KEY (auto)
) engine=ndb;
insert into t1 values 
mskold@mysql.com's avatar
mskold@mysql.com committed
32
(NULL,"aaaa","aaaa",0xAAAA,0xAAAA,-1,-1,-1,-1,-1,1.1,1.1,1.1,1,1,1,1,1, 
mskold@mysql.com's avatar
mskold@mysql.com committed
33 34 35
b'001','one','one',
'1901-01-01','1901', 
'01:01:01','1901-01-01 01:01:01',NULL),
mskold@mysql.com's avatar
mskold@mysql.com committed
36
(NULL,"bbbb","bbbb",0xBBBB,0xBBBB,-2,-2,-2,-2,-2,2.2,2.2,2.2,2,2,2,2,2,
mskold@mysql.com's avatar
mskold@mysql.com committed
37 38 39
b'010','two','one,two',
'1902-02-02','1902', 
'02:02:02','1902-02-02 02:02:02',NULL),
mskold@mysql.com's avatar
mskold@mysql.com committed
40
(NULL,"cccc","cccc",0xCCCC,0xCCCC,-3,-3,-3,-3,-3,3.3,3.3,3.3,3,3,3,3,3,
mskold@mysql.com's avatar
mskold@mysql.com committed
41 42 43
b'011','three','one,two,three',
'1903-03-03','1903', 
'03:03:03','1903-03-03 03:03:03',NULL),
mskold@mysql.com's avatar
mskold@mysql.com committed
44
(NULL,"dddd","dddd",0xDDDD,0xDDDD,-4,-4,-4,-4,-4,4.4,4.4,4.4,4,4,4,4,4,
mskold@mysql.com's avatar
mskold@mysql.com committed
45 46 47 48 49 50 51 52 53 54 55 56 57 58
b'100','four','one,two,three,four',
'1904-04-04','1904', 
'04:04:04','1904-04-04 04:04:04',NULL);
CREATE TABLE t2 (pk1 int unsigned NOT NULL PRIMARY KEY,   attr1 int unsigned NOT NULL,   attr2 int unsigned,   attr3 VARCHAR(10) ) ENGINE=ndbcluster;
insert into t2 values (0,0,0, "a"),(1,1,1,"b"),(2,2,NULL,NULL),(3,3,3,"d"),(4,4,4,"e"),(5,5,5,"f");
CREATE TABLE  t3 (pk1 int unsigned NOT NULL PRIMARY KEY,   attr1 int unsigned NOT NULL,   attr2 bigint unsigned, attr3 tinyint unsigned,  attr4 VARCHAR(10) ) ENGINE=ndbcluster;
insert into t3 values (0,0,0,0,"a"),(1,1,9223372036854775803,1,"b"),(2,2,9223372036854775804,2,"c"),(3,3,9223372036854775805,3,"d"),(4,4,9223372036854775806,4,"e"),(5,5,9223372036854775807,5,"f");
CREATE TABLE  t4 (pk1 int unsigned NOT NULL PRIMARY KEY,   attr1 int unsigned NOT NULL,   attr2 bigint unsigned, attr3 tinyint unsigned,  attr4 VARCHAR(10) , KEY (attr1)) ENGINE=ndbcluster;
insert into t4 values (0,0,0,0,"a"),(1,1,9223372036854775803,1,"b"),(2,2,9223372036854775804,2,"c"),(3,3,9223372036854775805,3,"d"),(4,4,9223372036854775806,4,"e"),(5,5,9223372036854775807,5,"f");
set @old_ecpd = @@session.engine_condition_pushdown;
set engine_condition_pushdown = off;
select auto from t1 where 
string = "aaaa" and 
vstring = "aaaa" and 
mskold@mysql.com's avatar
mskold@mysql.com committed
59 60
bin = 0xAAAA and 
vbin = 0xAAAA and 
mskold@mysql.com's avatar
mskold@mysql.com committed
61 62 63 64 65 66
tiny = -1 and 
short = -1 and 
medium = -1 and 
long_int = -1 and 
longlong = -1 and 
real_float > 1.0 and real_float < 2.0 and 
67 68
real_double > 1.0 and real_double < 2.0 and
real_decimal > 1.0 and real_decimal < 2.0 and
mskold@mysql.com's avatar
mskold@mysql.com committed
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
utiny = 1 and 
ushort = 1 and 
umedium = 1 and 
ulong = 1 and 
ulonglong = 1 and 
bits = b'001' and
options = 'one' and 
flags = 'one' and 
date_field = '1901-01-01' and
year_field = '1901' and
time_field = '01:01:01' and 
date_time = '1901-01-01 01:01:01' 
order by auto;
auto
1
select auto from t1 where 
string != "aaaa" and 
vstring != "aaaa" and 
mskold@mysql.com's avatar
mskold@mysql.com committed
87 88
bin != 0xAAAA and 
vbin != 0xAAAA and 
mskold@mysql.com's avatar
mskold@mysql.com committed
89 90 91 92 93 94
tiny != -1 and 
short != -1 and 
medium != -1 and 
long_int != -1 and 
longlong != -1 and 
(real_float < 1.0 or real_float > 2.0) and 
95 96
(real_double < 1.0 or real_double > 2.0) and
(real_decimal < 1.0 or real_decimal > 2.0) and
mskold@mysql.com's avatar
mskold@mysql.com committed
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
utiny != 1 and 
ushort != 1 and 
umedium != 1 and 
ulong != 1 and 
ulonglong != 1 and 
bits != b'001' and
options != 'one' and 
flags != 'one' and 
date_field != '1901-01-01' and
year_field != '1901' and
time_field != '01:01:01' and 
date_time != '1901-01-01 01:01:01' 
order by auto;
auto
2
3
4
select auto from t1 where 
string > "aaaa" and 
vstring > "aaaa" and 
mskold@mysql.com's avatar
mskold@mysql.com committed
117 118
bin > 0xAAAA and 
vbin > 0xAAAA and 
mskold@mysql.com's avatar
mskold@mysql.com committed
119 120 121 122 123 124 125
tiny < -1 and 
short < -1 and 
medium < -1 and 
long_int < -1 and 
longlong < -1 and 
real_float > 1.1 and 
real_double > 1.1 and 
126
real_decimal > 1.1 and 
mskold@mysql.com's avatar
mskold@mysql.com committed
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
utiny > 1 and 
ushort > 1 and 
umedium > 1 and 
ulong > 1 and 
ulonglong > 1 and
bits > b'001' and
(options = 'two' or options = 'three' or options = 'four') and
(flags = 'one,two' or flags = 'one,two,three' or flags = 'one,two,three,four') and
date_field > '1901-01-01' and
year_field > '1901' and
time_field > '01:01:01' and
date_time > '1901-01-01 01:01:01'
order by auto;
auto
2
3
4
select auto from t1 where 
string >= "aaaa" and 
vstring >= "aaaa" and 
mskold@mysql.com's avatar
mskold@mysql.com committed
147 148
bin >= 0xAAAA and 
vbin >= 0xAAAA and 
mskold@mysql.com's avatar
mskold@mysql.com committed
149 150 151 152 153 154 155
tiny <= -1 and 
short <= -1 and 
medium <= -1 and 
long_int <= -1 and 
longlong <= -1 and 
real_float >= 1.0 and 
real_double >= 1.0 and 
156
real_decimal >= 1.0 and 
mskold@mysql.com's avatar
mskold@mysql.com committed
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
utiny >= 1 and 
ushort >= 1 and 
umedium >= 1 and 
ulong >= 1 and 
ulonglong >= 1 and 
bits >= b'001' and
(options = 'one' or options = 'two' or options = 'three' or options = 'four') and
(flags = 'one' or flags = 'one,two' or flags = 'one,two,three' or flags = 'one,two,three,four') and
date_field >= '1901-01-01' and
year_field >= '1901' and
time_field >= '01:01:01' and 
date_time >= '1901-01-01 01:01:01' 
order by auto;
auto
1
2
3
4
select auto from t1 where 
string < "dddd" and 
vstring < "dddd" and 
mskold@mysql.com's avatar
mskold@mysql.com committed
178 179
bin < 0xDDDD and 
vbin < 0xDDDD and 
mskold@mysql.com's avatar
mskold@mysql.com committed
180 181 182 183 184 185 186
tiny > -4 and 
short > -4 and 
medium > -4 and 
long_int > -4 and 
longlong > -4 and 
real_float < 4.4 and 
real_double < 4.4 and
187
real_decimal < 4.4 and
mskold@mysql.com's avatar
mskold@mysql.com committed
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
utiny < 4 and 
ushort < 4 and 
umedium < 4 and 
ulong < 4 and 
ulonglong < 4 and 
bits < b'100' and
(options = 'one' or options = 'two' or options = 'three') and
(flags = 'one' or flags = 'one,two' or flags = 'one,two,three') and
date_field < '1904-01-01' and
year_field < '1904' and
time_field < '04:04:04' and 
date_time < '1904-04-04 04:04:04' 
order by auto;
auto
1
2
3
select auto from t1 where 
string <= "dddd" and 
vstring <= "dddd" and 
mskold@mysql.com's avatar
mskold@mysql.com committed
208 209
bin <= 0xDDDD and 
vbin <= 0xDDDD and 
mskold@mysql.com's avatar
mskold@mysql.com committed
210 211 212 213 214 215 216
tiny >= -4 and 
short >= -4 and 
medium >= -4 and 
long_int >= -4 and 
longlong >= -4 and 
real_float <= 4.5 and 
real_double <= 4.5 and 
217
real_decimal <= 4.5 and 
mskold@mysql.com's avatar
mskold@mysql.com committed
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
utiny <= 4 and 
ushort <= 4 and 
umedium <= 4 and 
ulong <= 4 and 
ulonglong <= 4 and 
bits <= b'100' and
(options = 'one' or options = 'two' or options = 'three' or options = 'four') and 
(flags = 'one' or flags = 'one,two' or flags = 'one,two,three' or flags = 'one,two,three,four') and
date_field <= '1904-04-04' and
year_field <= '1904' and
time_field <= '04:04:04' and 
date_time <= '1904-04-04 04:04:04' 
order by auto;
auto
1
2
3
4
236 237
select auto from t1 where 
string like "b%" and
238 239 240
vstring like "b%" and
bin like concat(0xBB, '%') and
vbin like concat(0xBB, '%')
241 242 243 244 245
order by auto;
auto
2
select auto from t1 where 
string not like "b%" and
246 247 248
vstring not like "b%" and
bin not like concat(0xBB, '%') and
vbin not like concat(0xBB, '%')
249 250 251 252 253
order by auto;
auto
1
3
4
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
select auto from t1 where
(string between "aaaa" and "cccc") and 
(vstring between "aaaa" and "cccc") and 
(bin between 0xAAAA and 0xCCCC) and 
(vbin between 0xAAAA and 0xCCCC) and 
(tiny between -3 and -1) and 
(short between -3 and -1) and 
(medium between -3 and -1) and 
(long_int between -3 and -1) and 
(longlong between -3 and -1) and 
(utiny between 1 and 3) and 
(ushort between 1 and 3) and 
(umedium between 1 and 3) and 
(ulong between 1 and 3) and 
(ulonglong between 1 and 3) and 
(bits between b'001' and b'011') and
(options between 'one' and 'three') and 
(flags between 'one' and 'one,two,three') and 
(date_field between '1901-01-01' and '1903-03-03') and
(year_field between '1901' and '1903') and
(time_field between '01:01:01' and '03:03:03') and 
(date_time between '1901-01-01 01:01:01' and '1903-03-03 03:03:03') 
order by auto;
auto
1
3
select auto from t1 where
("aaaa" between string and string) and 
("aaaa" between vstring and vstring) and 
(0xAAAA between bin and bin) and 
(0xAAAA between vbin and vbin) and 
(-1 between tiny and tiny) and 
(-1 between short and short) and 
(-1 between medium and medium) and 
(-1 between long_int and long_int) and 
(-1 between longlong and longlong) and 
(1 between utiny and utiny) and 
(1 between ushort and ushort) and 
(1 between umedium and umedium) and 
(1 between ulong and ulong) and 
(1 between ulonglong and ulonglong) and 
(b'001' between bits and bits) and
('one' between options and options) and 
('one' between flags and flags) and 
('1901-01-01' between date_field and date_field) and
('1901' between year_field and year_field) and
('01:01:01' between time_field and time_field) and 
('1901-01-01 01:01:01' between date_time and date_time) 
order by auto;
auto
1
select auto from t1 where
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357
(string not between "aaaa" and "cccc") and 
(vstring not between "aaaa" and "cccc") and 
(bin not between 0xAAAA and 0xCCCC) and 
(vbin not between 0xAAAA and 0xCCCC) and 
(tiny not between -3 and -1) and 
(short not between -3 and -1) and 
(medium not between -3 and -1) and 
(long_int not between -3 and -1) and 
(longlong not between -3 and -1) and 
(utiny not between 1 and 3) and 
(ushort not between 1 and 3) and 
(umedium not between 1 and 3) and 
(ulong not between 1 and 3) and 
(ulonglong not between 1 and 3) and 
(bits not between b'001' and b'011') and
(options not between 'one' and 'three') and 
(flags not between 'one' and 'one,two,three') and 
(date_field not between '1901-01-01' and '1903-03-03') and
(year_field not between '1901' and '1903') and
(time_field not between '01:01:01' and '03:03:03') and 
(date_time not between '1901-01-01 01:01:01' and '1903-03-03 03:03:03') 
order by auto;
auto
4
select auto from t1 where
("aaaa" not between string and string) and 
("aaaa" not between vstring and vstring) and 
(0xAAAA not between bin and bin) and 
(0xAAAA not between vbin and vbin) and 
(-1 not between tiny and tiny) and 
(-1 not between short and short) and 
(-1 not between medium and medium) and 
(-1 not between long_int and long_int) and 
(-1 not between longlong and longlong) and 
(1 not between utiny and utiny) and 
(1 not between ushort and ushort) and 
(1 not between umedium and umedium) and 
(1 not between ulong and ulong) and 
(1 not between ulonglong and ulonglong) and 
(b'001' not between bits and bits) and
('one' not between options and options) and 
('one' not between flags and flags) and 
('1901-01-01' not between date_field and date_field) and
('1901' not between year_field and year_field) and
('01:01:01' not between time_field and time_field) and 
('1901-01-01 01:01:01' not between date_time and date_time) 
order by auto;
auto
2
3
4
select auto from t1 where
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
string in("aaaa","cccc") and 
vstring in("aaaa","cccc") and 
bin in(0xAAAA,0xCCCC) and 
vbin in(0xAAAA,0xCCCC) and 
tiny in(-1,-3) and 
short in(-1,-3) and 
medium in(-1,-3) and 
long_int in(-1,-3) and 
longlong in(-1,-3) and 
utiny in(1,3) and 
ushort in(1,3) and 
umedium in(1,3) and 
ulong in(1,3) and 
ulonglong in(1,3) and 
bits in(b'001',b'011') and
options in('one','three') and 
flags in('one','one,two,three') and 
date_field in('1901-01-01','1903-03-03') and
year_field in('1901','1903') and
time_field in('01:01:01','03:03:03') and 
date_time in('1901-01-01 01:01:01','1903-03-03 03:03:03') 
order by auto;
auto
1
3
select auto from t1 where
"aaaa" in(string) and
"aaaa" in(vstring) and
0xAAAA in(bin) and 
0xAAAA in(vbin) and 
388 389 390 391 392
(-1 in(tiny)) and
(-1 in(short)) and
(-1 in(medium)) and
(-1 in(long_int)) and
(-1 in(longlong)) and
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
1 in(utiny) and 
1 in(ushort) and 
1 in(umedium) and 
1 in(ulong) and 
1 in(ulonglong) and 
b'001' in(bits) and
'one' in(options) and 
'one' in(flags) and 
'1901-01-01' in(date_field) and
'1901' in(year_field) and
'01:01:01' in(time_field) and 
'1901-01-01 01:01:01' in(date_time) 
order by auto;
auto
1
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460
select auto from t1 where
string not in("aaaa","cccc") and 
vstring not in("aaaa","cccc") and 
bin not in(0xAAAA,0xCCCC) and 
vbin not in(0xAAAA,0xCCCC) and 
tiny not in(-1,-3) and 
short not in(-1,-3) and 
medium not in(-1,-3) and 
long_int not in(-1,-3) and 
longlong not in(-1,-3) and 
utiny not in(1,3) and 
ushort not in(1,3) and 
umedium not in(1,3) and 
ulong not in(1,3) and 
ulonglong not in(1,3) and 
bits not in(b'001',b'011') and
options not in('one','three') and 
flags not in('one','one,two,three') and 
date_field not in('1901-01-01','1903-03-03') and
year_field not in('1901','1903') and
time_field not in('01:01:01','03:03:03') and 
date_time not in('1901-01-01 01:01:01','1903-03-03 03:03:03') 
order by auto;
auto
2
4
select auto from t1 where
"aaaa" not in(string) and
"aaaa" not in(vstring) and
0xAAAA not in(bin) and 
0xAAAA not in(vbin) and 
(-1 not in(tiny)) and
(-1 not in(short)) and
(-1 not in(medium)) and
(-1 not in(long_int)) and
(-1 not in(longlong)) and
1 not in(utiny) and 
1 not in(ushort) and 
1 not in(umedium) and 
1 not in(ulong) and 
1 not in(ulonglong) and 
b'001' not in(bits) and
'one' not in(options) and 
'one' not in(flags) and 
'1901-01-01' not in(date_field) and
'1901' not in(year_field) and
'01:01:01' not in(time_field) and 
'1901-01-01 01:01:01' not in(date_time) 
order by auto;
auto
2
3
4
mskold@mysql.com's avatar
mskold@mysql.com committed
461
select * from t2 where attr3 is null or attr1 > 2 and pk1= 3 order by pk1;
462 463 464
pk1	attr1	attr2	attr3
2	2	NULL	NULL
3	3	3	d
465 466 467 468 469
select * from t2 where attr3 is not null and attr1 > 2 order by pk1;
pk1	attr1	attr2	attr3
3	3	3	d
4	4	4	e
5	5	5	f
mskold@mysql.com's avatar
mskold@mysql.com committed
470
select * from t3 where attr2 >  9223372036854775803 and attr3 != 3 order by pk1;
471 472 473 474
pk1	attr1	attr2	attr3	attr4
2	2	9223372036854775804	2	c
4	4	9223372036854775806	4	e
5	5	9223372036854775807	5	f
475
select * from t2,t3 where t2.attr1 < 1 and t2.attr2 = t3.attr2 and t3.attr1 < 5 order by t2.pk1;
476
pk1	attr1	attr2	attr3	pk1	attr1	attr2	attr3	attr4
477
0	0	0	a	0	0	0	0	a
mskold@mysql.com's avatar
mskold@mysql.com committed
478 479 480 481 482 483 484 485 486 487
select * from t4 where attr1 < 5 and attr2 > 9223372036854775803 and attr3 != 3 order by t4.pk1;
pk1	attr1	attr2	attr3	attr4
2	2	9223372036854775804	2	c
4	4	9223372036854775806	4	e
select * from t3,t4 where t4.attr1 > 1 and t4.attr2 = t3.attr2 and t4.attr3 < 5 order by t4.pk1;
pk1	attr1	attr2	attr3	attr4	pk1	attr1	attr2	attr3	attr4
2	2	9223372036854775804	2	c	2	2	9223372036854775804	2	c
3	3	9223372036854775805	3	d	3	3	9223372036854775805	3	d
4	4	9223372036854775806	4	e	4	4	9223372036854775806	4	e
set engine_condition_pushdown = on;
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516
explain
select auto from t1 where 
string = "aaaa" and 
vstring = "aaaa" and 
bin = 0xAAAA and 
vbin = 0xAAAA and
tiny = -1 and 
short = -1 and 
medium = -1 and 
long_int = -1 and 
longlong = -1 and 
real_float > 1.0 and real_float < 2.0 and 
real_double > 1.0 and real_double < 2.0 and
real_decimal > 1.0 and real_decimal < 2.0 and
utiny = 1 and 
ushort = 1 and 
umedium = 1 and 
ulong = 1 and 
ulonglong = 1 and 
/* bits = b'001' and */
options = 'one' and 
flags = 'one' and 
date_field = '1901-01-01' and
year_field = '1901' and
time_field = '01:01:01' and 
date_time = '1901-01-01 01:01:01' 
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	Using where with pushed condition; Using filesort
mskold@mysql.com's avatar
mskold@mysql.com committed
517 518 519
select auto from t1 where 
string = "aaaa" and 
vstring = "aaaa" and 
mskold@mysql.com's avatar
mskold@mysql.com committed
520 521
bin = 0xAAAA and 
vbin = 0xAAAA and
mskold@mysql.com's avatar
mskold@mysql.com committed
522 523 524 525 526 527
tiny = -1 and 
short = -1 and 
medium = -1 and 
long_int = -1 and 
longlong = -1 and 
real_float > 1.0 and real_float < 2.0 and 
528 529
real_double > 1.0 and real_double < 2.0 and
real_decimal > 1.0 and real_decimal < 2.0 and
mskold@mysql.com's avatar
mskold@mysql.com committed
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544
utiny = 1 and 
ushort = 1 and 
umedium = 1 and 
ulong = 1 and 
ulonglong = 1 and 
/* bits = b'001' and */
options = 'one' and 
flags = 'one' and 
date_field = '1901-01-01' and
year_field = '1901' and
time_field = '01:01:01' and 
date_time = '1901-01-01 01:01:01' 
order by auto;
auto
1
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573
explain
select auto from t1 where 
string != "aaaa" and 
vstring != "aaaa" and 
bin != 0xAAAA and 
vbin != 0xAAAA and
tiny != -1 and 
short != -1 and 
medium != -1 and 
long_int != -1 and 
longlong != -1 and 
(real_float < 1.0 or real_float > 2.0) and 
(real_double < 1.0 or real_double > 2.0) and
(real_decimal < 1.0 or real_decimal > 2.0) and
utiny != 1 and 
ushort != 1 and 
umedium != 1 and 
ulong != 1 and 
ulonglong != 1 and 
/* bits != b'001' and */
options != 'one' and 
flags != 'one' and 
date_field != '1901-01-01' and
year_field != '1901' and
time_field != '01:01:01' and 
date_time != '1901-01-01 01:01:01' 
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	Using where with pushed condition; Using filesort
mskold@mysql.com's avatar
mskold@mysql.com committed
574 575 576
select auto from t1 where 
string != "aaaa" and 
vstring != "aaaa" and 
mskold@mysql.com's avatar
mskold@mysql.com committed
577 578
bin != 0xAAAA and 
vbin != 0xAAAA and
mskold@mysql.com's avatar
mskold@mysql.com committed
579 580 581 582 583 584
tiny != -1 and 
short != -1 and 
medium != -1 and 
long_int != -1 and 
longlong != -1 and 
(real_float < 1.0 or real_float > 2.0) and 
585 586
(real_double < 1.0 or real_double > 2.0) and
(real_decimal < 1.0 or real_decimal > 2.0) and
mskold@mysql.com's avatar
mskold@mysql.com committed
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603
utiny != 1 and 
ushort != 1 and 
umedium != 1 and 
ulong != 1 and 
ulonglong != 1 and 
/* bits != b'001' and */
options != 'one' and 
flags != 'one' and 
date_field != '1901-01-01' and
year_field != '1901' and
time_field != '01:01:01' and 
date_time != '1901-01-01 01:01:01' 
order by auto;
auto
2
3
4
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632
explain
select auto from t1 where 
string > "aaaa" and 
vstring > "aaaa" and 
bin > 0xAAAA and 
vbin > 0xAAAA and
tiny < -1 and 
short < -1 and 
medium < -1 and 
long_int < -1 and 
longlong < -1 and 
real_float > 1.1 and 
real_double > 1.1 and 
real_decimal > 1.1 and 
utiny > 1 and 
ushort > 1 and 
umedium > 1 and 
ulong > 1 and 
ulonglong > 1 and
/* bits > b'001' and */
(options = 'two' or options = 'three' or options = 'four') and
(flags = 'one,two' or flags = 'one,two,three' or flags = 'one,two,three,four') and
date_field > '1901-01-01' and
year_field > '1901' and
time_field > '01:01:01' and
date_time > '1901-01-01 01:01:01'
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	Using where with pushed condition; Using filesort
mskold@mysql.com's avatar
mskold@mysql.com committed
633 634 635
select auto from t1 where 
string > "aaaa" and 
vstring > "aaaa" and 
mskold@mysql.com's avatar
mskold@mysql.com committed
636 637
bin > 0xAAAA and 
vbin > 0xAAAA and
mskold@mysql.com's avatar
mskold@mysql.com committed
638 639 640 641 642 643 644
tiny < -1 and 
short < -1 and 
medium < -1 and 
long_int < -1 and 
longlong < -1 and 
real_float > 1.1 and 
real_double > 1.1 and 
645
real_decimal > 1.1 and 
mskold@mysql.com's avatar
mskold@mysql.com committed
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662
utiny > 1 and 
ushort > 1 and 
umedium > 1 and 
ulong > 1 and 
ulonglong > 1 and
/* bits > b'001' and */
(options = 'two' or options = 'three' or options = 'four') and
(flags = 'one,two' or flags = 'one,two,three' or flags = 'one,two,three,four') and
date_field > '1901-01-01' and
year_field > '1901' and
time_field > '01:01:01' and
date_time > '1901-01-01 01:01:01'
order by auto;
auto
2
3
4
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691
explain
select auto from t1 where 
string >= "aaaa" and 
vstring >= "aaaa" and 
bin >= 0xAAAA and 
vbin >= 0xAAAA and
tiny <= -1 and 
short <= -1 and 
medium <= -1 and 
long_int <= -1 and 
longlong <= -1 and 
real_float >= 1.0 and 
real_double >= 1.0 and 
real_decimal >= 1.0 and 
utiny >= 1 and 
ushort >= 1 and 
umedium >= 1 and 
ulong >= 1 and 
ulonglong >= 1 and 
/* bits >= b'001' and */
(options = 'one' or options = 'two' or options = 'three' or options = 'four') and
(flags = 'one' or flags = 'one,two' or flags = 'one,two,three' or flags = 'one,two,three,four') and
date_field >= '1901-01-01' and
year_field >= '1901' and
time_field >= '01:01:01' and 
date_time >= '1901-01-01 01:01:01' 
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	Using where with pushed condition; Using filesort
mskold@mysql.com's avatar
mskold@mysql.com committed
692 693 694
select auto from t1 where 
string >= "aaaa" and 
vstring >= "aaaa" and 
mskold@mysql.com's avatar
mskold@mysql.com committed
695 696
bin >= 0xAAAA and 
vbin >= 0xAAAA and
mskold@mysql.com's avatar
mskold@mysql.com committed
697 698 699 700 701 702 703
tiny <= -1 and 
short <= -1 and 
medium <= -1 and 
long_int <= -1 and 
longlong <= -1 and 
real_float >= 1.0 and 
real_double >= 1.0 and 
704
real_decimal >= 1.0 and 
mskold@mysql.com's avatar
mskold@mysql.com committed
705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722
utiny >= 1 and 
ushort >= 1 and 
umedium >= 1 and 
ulong >= 1 and 
ulonglong >= 1 and 
/* bits >= b'001' and */
(options = 'one' or options = 'two' or options = 'three' or options = 'four') and
(flags = 'one' or flags = 'one,two' or flags = 'one,two,three' or flags = 'one,two,three,four') and
date_field >= '1901-01-01' and
year_field >= '1901' and
time_field >= '01:01:01' and 
date_time >= '1901-01-01 01:01:01' 
order by auto;
auto
1
2
3
4
723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751
explain
select auto from t1 where 
string < "dddd" and 
vstring < "dddd" and 
bin < 0xDDDD and 
vbin < 0xDDDD and
tiny > -4 and 
short > -4 and 
medium > -4 and 
long_int > -4 and 
longlong > -4 and 
real_float < 4.4 and 
real_double < 4.4 and
real_decimal < 4.4 and
utiny < 4 and 
ushort < 4 and 
umedium < 4 and 
ulong < 4 and 
ulonglong < 4 and 
/* bits < b'100' and */
(options = 'one' or options = 'two' or options = 'three') and
(flags = 'one' or flags = 'one,two' or flags = 'one,two,three') and
date_field < '1904-01-01' and
year_field < '1904' and
time_field < '04:04:04' and 
date_time < '1904-04-04 04:04:04' 
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	Using where with pushed condition; Using filesort
mskold@mysql.com's avatar
mskold@mysql.com committed
752 753 754
select auto from t1 where 
string < "dddd" and 
vstring < "dddd" and 
mskold@mysql.com's avatar
mskold@mysql.com committed
755 756
bin < 0xDDDD and 
vbin < 0xDDDD and
mskold@mysql.com's avatar
mskold@mysql.com committed
757 758 759 760 761 762 763
tiny > -4 and 
short > -4 and 
medium > -4 and 
long_int > -4 and 
longlong > -4 and 
real_float < 4.4 and 
real_double < 4.4 and
764
real_decimal < 4.4 and
mskold@mysql.com's avatar
mskold@mysql.com committed
765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781
utiny < 4 and 
ushort < 4 and 
umedium < 4 and 
ulong < 4 and 
ulonglong < 4 and 
/* bits < b'100' and */
(options = 'one' or options = 'two' or options = 'three') and
(flags = 'one' or flags = 'one,two' or flags = 'one,two,three') and
date_field < '1904-01-01' and
year_field < '1904' and
time_field < '04:04:04' and 
date_time < '1904-04-04 04:04:04' 
order by auto;
auto
1
2
3
782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810
explain
select auto from t1 where 
string <= "dddd" and 
vstring <= "dddd" and 
bin <= 0xDDDD and 
vbin <= 0xDDDD and
tiny >= -4 and 
short >= -4 and 
medium >= -4 and 
long_int >= -4 and 
longlong >= -4 and 
real_float <= 4.5 and 
real_double <= 4.5 and 
real_decimal <= 4.5 and 
utiny <= 4 - 1 + 1 and /* Checking function composition */
ushort <= 4 and 
umedium <= 4 and 
ulong <= 4 and 
ulonglong <= 4 and 
/* bits <= b'100' and */
(options = 'one' or options = 'two' or options = 'three' or options = 'four') and 
(flags = 'one' or flags = 'one,two' or flags = 'one,two,three' or flags = 'one,two,three,four') and
date_field <= '1904-04-04' and
year_field <= '1904' and
time_field <= '04:04:04' and 
date_time <= '1904-04-04 04:04:04' 
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	Using where with pushed condition; Using filesort
mskold@mysql.com's avatar
mskold@mysql.com committed
811 812 813
select auto from t1 where 
string <= "dddd" and 
vstring <= "dddd" and 
mskold@mysql.com's avatar
mskold@mysql.com committed
814 815
bin <= 0xDDDD and 
vbin <= 0xDDDD and
mskold@mysql.com's avatar
mskold@mysql.com committed
816 817 818 819 820 821 822
tiny >= -4 and 
short >= -4 and 
medium >= -4 and 
long_int >= -4 and 
longlong >= -4 and 
real_float <= 4.5 and 
real_double <= 4.5 and 
823
real_decimal <= 4.5 and 
mskold@mysql.com's avatar
mskold@mysql.com committed
824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842
utiny <= 4 - 1 + 1 and /* Checking function composition */
ushort <= 4 and 
umedium <= 4 and 
ulong <= 4 and 
ulonglong <= 4 and 
/* bits <= b'100' and */
(options = 'one' or options = 'two' or options = 'three' or options = 'four') and 
(flags = 'one' or flags = 'one,two' or flags = 'one,two,three' or flags = 'one,two,three,four') and
date_field <= '1904-04-04' and
year_field <= '1904' and
time_field <= '04:04:04' and 
date_time <= '1904-04-04 04:04:04' 
order by auto;
auto
1
2
3
4
create index medium_index on t1(medium);
843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871
explain
select auto from t1 where 
string = "aaaa" and 
vstring = "aaaa" and 
bin = 0xAAAA and 
vbin = 0xAAAA and
tiny = -1 and 
short = -1 and 
medium = -1 and 
long_int = -1 and 
longlong = -1 and 
real_float > 1.0 and real_float < 2.0 and 
real_double > 1.0 and real_double < 2.0 and
real_decimal > 1.0 and real_decimal < 2.0 and
utiny = 1 and 
ushort = 1 and 
umedium = 1 and 
ulong = 1 and 
ulonglong = 1 and 
/* bits = b'001' and */
options = 'one' and 
flags = 'one' and 
date_field = '1901-01-01' and
year_field = '1901' and
time_field = '01:01:01' and 
date_time = '1901-01-01 01:01:01' 
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ref	medium_index	medium_index	3	const	10	Using where with pushed condition; Using filesort
mskold@mysql.com's avatar
mskold@mysql.com committed
872 873 874
select auto from t1 where 
string = "aaaa" and 
vstring = "aaaa" and 
mskold@mysql.com's avatar
mskold@mysql.com committed
875 876
bin = 0xAAAA and 
vbin = 0xAAAA and
mskold@mysql.com's avatar
mskold@mysql.com committed
877 878 879 880 881 882
tiny = -1 and 
short = -1 and 
medium = -1 and 
long_int = -1 and 
longlong = -1 and 
real_float > 1.0 and real_float < 2.0 and 
883 884
real_double > 1.0 and real_double < 2.0 and
real_decimal > 1.0 and real_decimal < 2.0 and
mskold@mysql.com's avatar
mskold@mysql.com committed
885 886 887 888 889 890 891 892 893 894 895 896 897 898 899
utiny = 1 and 
ushort = 1 and 
umedium = 1 and 
ulong = 1 and 
ulonglong = 1 and 
/* bits = b'001' and */
options = 'one' and 
flags = 'one' and 
date_field = '1901-01-01' and
year_field = '1901' and
time_field = '01:01:01' and 
date_time = '1901-01-01 01:01:01' 
order by auto;
auto
1
900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928
explain
select auto from t1 where 
string != "aaaa" and 
vstring != "aaaa" and 
bin != 0xAAAA and 
vbin != 0xAAAA and
tiny != -1 and 
short != -1 and 
medium != -1 and 
long_int != -1 and 
longlong != -1 and 
(real_float < 1.0 or real_float > 2.0) and 
(real_double < 1.0 or real_double > 2.0) and
(real_decimal < 1.0 or real_decimal > 2.0) and
utiny != 1 and 
ushort != 1 and 
umedium != 1 and 
ulong != 1 and 
ulonglong != 1 and 
/* bits != b'001' and */
options != 'one' and 
flags != 'one' and 
date_field != '1901-01-01' and
year_field != '1901' and
time_field != '01:01:01' and 
date_time != '1901-01-01 01:01:01' 
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	range	medium_index	medium_index	3	NULL	20	Using where with pushed condition; Using filesort
mskold@mysql.com's avatar
mskold@mysql.com committed
929 930 931
select auto from t1 where 
string != "aaaa" and 
vstring != "aaaa" and 
mskold@mysql.com's avatar
mskold@mysql.com committed
932 933
bin != 0xAAAA and 
vbin != 0xAAAA and
mskold@mysql.com's avatar
mskold@mysql.com committed
934 935 936 937 938 939
tiny != -1 and 
short != -1 and 
medium != -1 and 
long_int != -1 and 
longlong != -1 and 
(real_float < 1.0 or real_float > 2.0) and 
940 941
(real_double < 1.0 or real_double > 2.0) and
(real_decimal < 1.0 or real_decimal > 2.0) and
mskold@mysql.com's avatar
mskold@mysql.com committed
942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958
utiny != 1 and 
ushort != 1 and 
umedium != 1 and 
ulong != 1 and 
ulonglong != 1 and 
/* bits != b'001' and */
options != 'one' and 
flags != 'one' and 
date_field != '1901-01-01' and
year_field != '1901' and
time_field != '01:01:01' and 
date_time != '1901-01-01 01:01:01' 
order by auto;
auto
2
3
4
959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987
explain
select auto from t1 where 
string > "aaaa" and 
vstring > "aaaa" and 
bin > 0xAAAA and 
vbin > 0xAAAA and
tiny < -1 and 
short < -1 and 
medium < -1 and 
long_int < -1 and 
longlong < -1 and 
real_float > 1.1 and 
real_double > 1.1 and 
real_decimal > 1.1 and 
utiny > 1 and 
ushort > 1 and 
umedium > 1 and 
ulong > 1 and 
ulonglong > 1 and
/* bits > b'001' and */
(options = 'two' or options = 'three' or options = 'four') and
(flags = 'one,two' or flags = 'one,two,three' or flags = 'one,two,three,four') and
date_field > '1901-01-01' and
year_field > '1901' and
time_field > '01:01:01' and
date_time > '1901-01-01 01:01:01'
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	range	medium_index	medium_index	3	NULL	10	Using where with pushed condition; Using filesort
mskold@mysql.com's avatar
mskold@mysql.com committed
988 989 990
select auto from t1 where 
string > "aaaa" and 
vstring > "aaaa" and 
mskold@mysql.com's avatar
mskold@mysql.com committed
991 992
bin > 0xAAAA and 
vbin > 0xAAAA and
mskold@mysql.com's avatar
mskold@mysql.com committed
993 994 995 996 997 998 999
tiny < -1 and 
short < -1 and 
medium < -1 and 
long_int < -1 and 
longlong < -1 and 
real_float > 1.1 and 
real_double > 1.1 and 
1000
real_decimal > 1.1 and 
mskold@mysql.com's avatar
mskold@mysql.com committed
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017
utiny > 1 and 
ushort > 1 and 
umedium > 1 and 
ulong > 1 and 
ulonglong > 1 and
/* bits > b'001' and */
(options = 'two' or options = 'three' or options = 'four') and
(flags = 'one,two' or flags = 'one,two,three' or flags = 'one,two,three,four') and
date_field > '1901-01-01' and
year_field > '1901' and
time_field > '01:01:01' and
date_time > '1901-01-01 01:01:01'
order by auto;
auto
2
3
4
1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046
explain
select auto from t1 where 
string >= "aaaa" and 
vstring >= "aaaa" and 
bin >= 0xAAAA and 
vbin >= 0xAAAA and
tiny <= -1 and 
short <= -1 and 
medium <= -1 and 
long_int <= -1 and 
longlong <= -1 and 
real_float >= 1.0 and 
real_double >= 1.0 and 
real_decimal >= 1.0 and 
utiny >= 1 and 
ushort >= 1 and 
umedium >= 1 and 
ulong >= 1 and 
ulonglong >= 1 and 
/* bits >= b'001' and */
(options = 'one' or options = 'two' or options = 'three' or options = 'four') and
(flags = 'one' or flags = 'one,two' or flags = 'one,two,three' or flags = 'one,two,three,four') and
date_field >= '1901-01-01' and
year_field >= '1901' and
time_field >= '01:01:01' and 
date_time >= '1901-01-01 01:01:01' 
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	range	medium_index	medium_index	3	NULL	10	Using where with pushed condition; Using filesort
mskold@mysql.com's avatar
mskold@mysql.com committed
1047 1048 1049
select auto from t1 where 
string >= "aaaa" and 
vstring >= "aaaa" and 
mskold@mysql.com's avatar
mskold@mysql.com committed
1050 1051
bin >= 0xAAAA and 
vbin >= 0xAAAA and
mskold@mysql.com's avatar
mskold@mysql.com committed
1052 1053 1054 1055 1056 1057 1058
tiny <= -1 and 
short <= -1 and 
medium <= -1 and 
long_int <= -1 and 
longlong <= -1 and 
real_float >= 1.0 and 
real_double >= 1.0 and 
1059
real_decimal >= 1.0 and 
mskold@mysql.com's avatar
mskold@mysql.com committed
1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077
utiny >= 1 and 
ushort >= 1 and 
umedium >= 1 and 
ulong >= 1 and 
ulonglong >= 1 and 
/* bits >= b'001' and */
(options = 'one' or options = 'two' or options = 'three' or options = 'four') and
(flags = 'one' or flags = 'one,two' or flags = 'one,two,three' or flags = 'one,two,three,four') and
date_field >= '1901-01-01' and
year_field >= '1901' and
time_field >= '01:01:01' and 
date_time >= '1901-01-01 01:01:01' 
order by auto;
auto
1
2
3
4
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106
explain
select auto from t1 where 
string < "dddd" and 
vstring < "dddd" and 
bin < 0xDDDD and 
vbin < 0xDDDD and
tiny > -4 and 
short > -4 and 
medium > -4 and 
long_int > -4 and 
longlong > -4 and 
real_float < 4.4 and 
real_double < 4.4 and
real_decimal < 4.4 and
utiny < 4 and 
ushort < 4 and 
umedium < 4 and 
ulong < 4 and 
ulonglong < 4 and 
/* bits < b'100' and */
(options = 'one' or options = 'two' or options = 'three') and
(flags = 'one' or flags = 'one,two' or flags = 'one,two,three') and
date_field < '1904-01-01' and
year_field < '1904' and
time_field < '04:04:04' and 
date_time < '1904-04-04 04:04:04' 
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	range	medium_index	medium_index	3	NULL	10	Using where with pushed condition; Using filesort
mskold@mysql.com's avatar
mskold@mysql.com committed
1107 1108 1109
select auto from t1 where 
string < "dddd" and 
vstring < "dddd" and 
mskold@mysql.com's avatar
mskold@mysql.com committed
1110 1111
bin < 0xDDDD and 
vbin < 0xDDDD and
mskold@mysql.com's avatar
mskold@mysql.com committed
1112 1113 1114 1115 1116 1117 1118
tiny > -4 and 
short > -4 and 
medium > -4 and 
long_int > -4 and 
longlong > -4 and 
real_float < 4.4 and 
real_double < 4.4 and
1119
real_decimal < 4.4 and
mskold@mysql.com's avatar
mskold@mysql.com committed
1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136
utiny < 4 and 
ushort < 4 and 
umedium < 4 and 
ulong < 4 and 
ulonglong < 4 and 
/* bits < b'100' and */
(options = 'one' or options = 'two' or options = 'three') and
(flags = 'one' or flags = 'one,two' or flags = 'one,two,three') and
date_field < '1904-01-01' and
year_field < '1904' and
time_field < '04:04:04' and 
date_time < '1904-04-04 04:04:04' 
order by auto;
auto
1
2
3
1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165
explain
select auto from t1 where 
string <= "dddd" and 
vstring <= "dddd" and 
bin <= 0xDDDD and 
vbin <= 0xDDDD and
tiny >= -4 and 
short >= -4 and 
medium >= -4 and 
long_int >= -4 and 
longlong >= -4 and 
real_float <= 4.5 and 
real_double <= 4.5 and 
real_decimal <= 4.5 and 
utiny <= 4 - 1 + 1 and /* Checking function composition */
ushort <= 4 and 
umedium <= 4 and 
ulong <= 4 and 
ulonglong <= 4 and 
/* bits <= b'100' and */
(options = 'one' or options = 'two' or options = 'three' or options = 'four') and 
(flags = 'one' or flags = 'one,two' or flags = 'one,two,three' or flags = 'one,two,three,four') and
date_field <= '1904-04-04' and
year_field <= '1904' and
time_field <= '04:04:04' and 
date_time <= '1904-04-04 04:04:04' 
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	range	medium_index	medium_index	3	NULL	10	Using where with pushed condition; Using filesort
mskold@mysql.com's avatar
mskold@mysql.com committed
1166 1167 1168
select auto from t1 where 
string <= "dddd" and 
vstring <= "dddd" and 
mskold@mysql.com's avatar
mskold@mysql.com committed
1169 1170
bin <= 0xDDDD and 
vbin <= 0xDDDD and
mskold@mysql.com's avatar
mskold@mysql.com committed
1171 1172 1173 1174 1175 1176 1177
tiny >= -4 and 
short >= -4 and 
medium >= -4 and 
long_int >= -4 and 
longlong >= -4 and 
real_float <= 4.5 and 
real_double <= 4.5 and 
1178
real_decimal <= 4.5 and 
mskold@mysql.com's avatar
mskold@mysql.com committed
1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196
utiny <= 4 - 1 + 1 and /* Checking function composition */
ushort <= 4 and 
umedium <= 4 and 
ulong <= 4 and 
ulonglong <= 4 and 
/* bits <= b'100' and */
(options = 'one' or options = 'two' or options = 'three' or options = 'four') and 
(flags = 'one' or flags = 'one,two' or flags = 'one,two,three' or flags = 'one,two,three,four') and
date_field <= '1904-04-04' and
year_field <= '1904' and
time_field <= '04:04:04' and 
date_time <= '1904-04-04 04:04:04' 
order by auto;
auto
1
2
3
4
1197 1198 1199 1200 1201 1202 1203 1204 1205
explain
select auto from t1 where 
string like "b%" and
vstring like "b%" and
bin like concat(0xBB, '%') and
vbin like concat(0xBB, '%')
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	Using where with pushed condition; Using filesort
1206 1207
select auto from t1 where 
string like "b%" and
1208 1209 1210
vstring like "b%" and
bin like concat(0xBB, '%') and
vbin like concat(0xBB, '%')
1211 1212 1213
order by auto;
auto
2
1214 1215 1216 1217 1218 1219 1220 1221 1222
explain
select auto from t1 where 
string not like "b%" and
vstring not like "b%" and
bin not like concat(0xBB, '%') and
vbin not like concat(0xBB, '%')
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	Using where with pushed condition; Using filesort
1223 1224
select auto from t1 where 
string not like "b%" and
1225 1226 1227
vstring not like "b%" and
bin not like concat(0xBB, '%') and
vbin not like concat(0xBB, '%')
1228 1229 1230 1231 1232
order by auto;
auto
1
3
4
1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309
explain 
select auto from t1 where
(string between "aaaa" and "cccc") and 
(vstring between "aaaa" and "cccc") and 
(bin between 0xAAAA and 0xCCCC) and 
(vbin between 0xAAAA and 0xCCCC) and 
(tiny between -3 and -1) and 
(short between -3 and -1) and 
(medium between -3 and -1) and 
(long_int between -3 and -1) and 
(longlong between -3 and -1) and 
(utiny between 1 and 3) and 
(ushort between 1 and 3) and 
(umedium between 1 and 3) and 
(ulong between 1 and 3) and 
(ulonglong between 1 and 3) and 
/* (bits between b'001' and b'011') and */
(options between 'one' and 'three') and 
(flags between 'one' and 'one,two,three') and 
(date_field between '1901-01-01' and '1903-03-03') and
(year_field between '1901' and '1903') and
(time_field between '01:01:01' and '03:03:03') and 
(date_time between '1901-01-01 01:01:01' and '1903-03-03 03:03:03') 
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	range	medium_index	medium_index	3	NULL	10	Using where with pushed condition; Using filesort
select auto from t1 where
(string between "aaaa" and "cccc") and 
(vstring between "aaaa" and "cccc") and 
(bin between 0xAAAA and 0xCCCC) and 
(vbin between 0xAAAA and 0xCCCC) and 
(tiny between -3 and -1) and 
(short between -3 and -1) and 
(medium between -3 and -1) and 
(long_int between -3 and -1) and 
(longlong between -3 and -1) and 
(utiny between 1 and 3) and 
(ushort between 1 and 3) and 
(umedium between 1 and 3) and 
(ulong between 1 and 3) and 
(ulonglong between 1 and 3) and 
/* (bits between b'001' and b'011') and */
(options between 'one' and 'three') and 
(flags between 'one' and 'one,two,three') and 
(date_field between '1901-01-01' and '1903-03-03') and
(year_field between '1901' and '1903') and
(time_field between '01:01:01' and '03:03:03') and 
(date_time between '1901-01-01 01:01:01' and '1903-03-03 03:03:03') 
order by auto;
auto
1
3
explain
select auto from t1 where
("aaaa" between string and string) and 
("aaaa" between vstring and vstring) and 
(0xAAAA between bin and bin) and 
(0xAAAA between vbin and vbin) and 
(-1 between tiny and tiny) and 
(-1 between short and short) and 
(-1 between medium and medium) and 
(-1 between long_int and long_int) and 
(-1 between longlong and longlong) and 
(1 between utiny and utiny) and 
(1 between ushort and ushort) and 
(1 between umedium and umedium) and 
(1 between ulong and ulong) and 
(1 between ulonglong and ulonglong) and 
/* (b'001' between bits and bits) and */
('one' between options and options) and 
('one' between flags and flags) and 
('1901-01-01' between date_field and date_field) and
('1901' between year_field and year_field) and
('01:01:01' between time_field and time_field) and 
('1901-01-01 01:01:01' between date_time and date_time) 
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1310
1	SIMPLE	t1	range	medium_index	medium_index	3	NULL	10	Using where with pushed condition; Using filesort
1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335
select auto from t1 where
("aaaa" between string and string) and 
("aaaa" between vstring and vstring) and 
(0xAAAA between bin and bin) and 
(0xAAAA between vbin and vbin) and 
(-1 between tiny and tiny) and 
(-1 between short and short) and 
(-1 between medium and medium) and 
(-1 between long_int and long_int) and 
(-1 between longlong and longlong) and 
(1 between utiny and utiny) and 
(1 between ushort and ushort) and 
(1 between umedium and umedium) and 
(1 between ulong and ulong) and 
(1 between ulonglong and ulonglong) and 
/* (b'001' between bits and bits) and */
('one' between options and options) and 
('one' between flags and flags) and 
('1901-01-01' between date_field and date_field) and
('1901' between year_field and year_field) and
('01:01:01' between time_field and time_field) and 
('1901-01-01 01:01:01' between date_time and date_time) 
order by auto;
auto
1
1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411
explain 
select auto from t1 where
(string not between "aaaa" and "cccc") and 
(vstring not between "aaaa" and "cccc") and 
(bin not between 0xAAAA and 0xCCCC) and 
(vbin not between 0xAAAA and 0xCCCC) and 
(tiny not between -3 and -1) and 
(short not between -3 and -1) and 
(medium not between -3 and -1) and 
(long_int not between -3 and -1) and 
(longlong not between -3 and -1) and 
(utiny not between 1 and 3) and 
(ushort not between 1 and 3) and 
(umedium not between 1 and 3) and 
(ulong not between 1 and 3) and 
(ulonglong not between 1 and 3) and 
/* (bits not between b'001' and b'011') and */
(options not between 'one' and 'three') and 
(flags not between 'one' and 'one,two,three') and 
(date_field not between '1901-01-01' and '1903-03-03') and
(year_field not between '1901' and '1903') and
(time_field not between '01:01:01' and '03:03:03') and 
(date_time not between '1901-01-01 01:01:01' and '1903-03-03 03:03:03') 
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	range	medium_index	medium_index	3	NULL	20	Using where with pushed condition; Using filesort
select auto from t1 where
(string not between "aaaa" and "cccc") and 
(vstring not between "aaaa" and "cccc") and 
(bin not between 0xAAAA and 0xCCCC) and 
(vbin not between 0xAAAA and 0xCCCC) and 
(tiny not between -3 and -1) and 
(short not between -3 and -1) and 
(medium not between -3 and -1) and 
(long_int not between -3 and -1) and 
(longlong not between -3 and -1) and 
(utiny not between 1 and 3) and 
(ushort not between 1 and 3) and 
(umedium not between 1 and 3) and 
(ulong not between 1 and 3) and 
(ulonglong not between 1 and 3) and 
/* (bits not between b'001' and b'011') and */
(options not between 'one' and 'three') and 
(flags not between 'one' and 'one,two,three') and 
(date_field not between '1901-01-01' and '1903-03-03') and
(year_field not between '1901' and '1903') and
(time_field not between '01:01:01' and '03:03:03') and 
(date_time not between '1901-01-01 01:01:01' and '1903-03-03 03:03:03') 
order by auto;
auto
4
explain
select auto from t1 where
("aaaa" not between string and string) and 
("aaaa" not between vstring and vstring) and 
(0xAAAA not between bin and bin) and 
(0xAAAA not between vbin and vbin) and 
(-1 not between tiny and tiny) and 
(-1 not between short and short) and 
(-1 not between medium and medium) and 
(-1 not between long_int and long_int) and 
(-1 not between longlong and longlong) and 
(1 not between utiny and utiny) and 
(1 not between ushort and ushort) and 
(1 not between umedium and umedium) and 
(1 not between ulong and ulong) and 
(1 not between ulonglong and ulonglong) and 
/* (b'001' not between bits and bits) and */
('one' not between options and options) and 
('one' not between flags and flags) and 
('1901-01-01' not between date_field and date_field) and
('1901' not between year_field and year_field) and
('01:01:01' not between time_field and time_field) and 
('1901-01-01 01:01:01' not between date_time and date_time) 
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1412
1	SIMPLE	t1	range	medium_index	medium_index	3	NULL	20	Using where with pushed condition; Using filesort
1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439
select auto from t1 where
("aaaa" not between string and string) and 
("aaaa" not between vstring and vstring) and 
(0xAAAA not between bin and bin) and 
(0xAAAA not between vbin and vbin) and 
(-1 not between tiny and tiny) and 
(-1 not between short and short) and 
(-1 not between medium and medium) and 
(-1 not between long_int and long_int) and 
(-1 not between longlong and longlong) and 
(1 not between utiny and utiny) and 
(1 not between ushort and ushort) and 
(1 not between umedium and umedium) and 
(1 not between ulong and ulong) and 
(1 not between ulonglong and ulonglong) and 
/* (b'001' not between bits and bits) and */
('one' not between options and options) and 
('one' not between flags and flags) and 
('1901-01-01' not between date_field and date_field) and
('1901' not between year_field and year_field) and
('01:01:01' not between time_field and time_field) and 
('1901-01-01 01:01:01' not between date_time and date_time) 
order by auto;
auto
2
3
4
1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497
explain
select auto from t1 where
string in("aaaa","cccc") and 
vstring in("aaaa","cccc") and 
bin in(0xAAAA,0xCCCC) and 
vbin in(0xAAAA,0xCCCC) and 
tiny in(-1,-3) and 
short in(-1,-3) and 
medium in(-1,-3) and 
long_int in(-1,-3) and 
longlong in(-1,-3) and 
utiny in(1,3) and 
ushort in(1,3) and 
umedium in(1,3) and 
ulong in(1,3) and 
ulonglong in(1,3) and 
/* bits in(b'001',b'011') and */
options in('one','three') and 
flags in('one','one,two,three') and 
date_field in('1901-01-01','1903-03-03') and
year_field in('1901','1903') and
time_field in('01:01:01','03:03:03') and 
date_time in('1901-01-01 01:01:01','1903-03-03 03:03:03') 
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	range	medium_index	medium_index	3	NULL	20	Using where with pushed condition; Using filesort
select auto from t1 where
string in("aaaa","cccc") and 
vstring in("aaaa","cccc") and 
bin in(0xAAAA,0xCCCC) and 
vbin in(0xAAAA,0xCCCC) and 
tiny in(-1,-3) and 
short in(-1,-3) and 
medium in(-1,-3) and 
long_int in(-1,-3) and 
longlong in(-1,-3) and 
utiny in(1,3) and 
ushort in(1,3) and 
umedium in(1,3) and 
ulong in(1,3) and 
ulonglong in(1,3) and 
/* bits in(b'001',b'011') and */
options in('one','three') and 
flags in('one','one,two,three') and 
date_field in('1901-01-01','1903-03-03') and
year_field in('1901','1903') and
time_field in('01:01:01','03:03:03') and 
date_time in('1901-01-01 01:01:01','1903-03-03 03:03:03') 
order by auto;
auto
1
3
explain
select auto from t1 where
"aaaa" in(string) and 
"aaaa" in(vstring) and 
0xAAAA in(bin) and 
0xAAAA in(vbin) and 
1498 1499 1500 1501 1502
(-1 in(tiny)) and
(-1 in (short)) and
(-1 in(medium)) and
(-1 in(long_int)) and
(-1 in(longlong)) and
1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516
1 in(utiny) and 
1 in(ushort) and 
1 in(umedium) and 
1 in(ulong) and 
1 in(ulonglong) and 
/* b'001' in(bits) and */
'one' in(options) and 
'one' in(flags) and 
'1901-01-01' in(date_field) and
'1901' in(year_field) and
'01:01:01' in(time_field) and 
'1901-01-01 01:01:01' in(date_time) 
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
mskold@mysql.com's avatar
mskold@mysql.com committed
1517
1	SIMPLE	t1	ref	medium_index	medium_index	3	const	10	Using where with pushed condition; Using filesort
1518 1519 1520 1521 1522
select auto from t1 where
"aaaa" in(string) and 
"aaaa" in(vstring) and 
0xAAAA in(bin) and 
0xAAAA in(vbin) and 
1523 1524 1525 1526 1527
(-1 in(tiny)) and
(-1 in (short)) and
(-1 in(medium)) and
(-1 in(long_int)) and
(-1 in(longlong)) and
1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542
1 in(utiny) and 
1 in(ushort) and 
1 in(umedium) and 
1 in(ulong) and 
1 in(ulonglong) and 
/* b'001' in(bits) and */
'one' in(options) and 
'one' in(flags) and 
'1901-01-01' in(date_field) and
'1901' in(year_field) and
'01:01:01' in(time_field) and 
'1901-01-01 01:01:01' in(date_time) 
order by auto;
auto
1
1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647
explain
select auto from t1 where
string not in("aaaa","cccc") and 
vstring not in("aaaa","cccc") and 
bin not in(0xAAAA,0xCCCC) and 
vbin not in(0xAAAA,0xCCCC) and 
tiny not in(-1,-3) and 
short not in(-1,-3) and 
medium not in(-1,-3) and 
long_int not in(-1,-3) and 
longlong not in(-1,-3) and 
utiny not in(1,3) and 
ushort not in(1,3) and 
umedium not in(1,3) and 
ulong not in(1,3) and 
ulonglong not in(1,3) and 
/* bits not in(b'001',b'011') and */
options not in('one','three') and 
flags not in('one','one,two,three') and 
date_field not in('1901-01-01','1903-03-03') and
year_field not in('1901','1903') and
time_field not in('01:01:01','03:03:03') and 
date_time not in('1901-01-01 01:01:01','1903-03-03 03:03:03') 
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	range	medium_index	medium_index	3	NULL	30	Using where with pushed condition; Using filesort
select auto from t1 where
string not in("aaaa","cccc") and 
vstring not in("aaaa","cccc") and 
bin not in(0xAAAA,0xCCCC) and 
vbin not in(0xAAAA,0xCCCC) and 
tiny not in(-1,-3) and 
short not in(-1,-3) and 
medium not in(-1,-3) and 
long_int not in(-1,-3) and 
longlong not in(-1,-3) and 
utiny not in(1,3) and 
ushort not in(1,3) and 
umedium not in(1,3) and 
ulong not in(1,3) and 
ulonglong not in(1,3) and 
/* bits not in(b'001',b'011') and */
options not in('one','three') and 
flags not in('one','one,two,three') and 
date_field not in('1901-01-01','1903-03-03') and
year_field not in('1901','1903') and
time_field not in('01:01:01','03:03:03') and 
date_time not in('1901-01-01 01:01:01','1903-03-03 03:03:03') 
order by auto;
auto
2
4
explain
select auto from t1 where
"aaaa" not in(string) and 
"aaaa" not in(vstring) and 
0xAAAA not in(bin) and 
0xAAAA not in(vbin) and 
(-1 not in(tiny)) and
(-1 not in(short)) and
(-1 not in(medium)) and
(-1 not in(long_int)) and
(-1 not in(longlong)) and
1 not in(utiny) and 
1 not in(ushort) and 
1 not in(umedium) and 
1 not in(ulong) and 
1 not in(ulonglong) and 
/* b'001' not in(bits) and */
'one' not in(options) and 
'one' not in(flags) and 
'1901-01-01' not in(date_field) and
'1901' not in(year_field) and
'01:01:01' not in(time_field) and 
'1901-01-01 01:01:01' not in(date_time) 
order by auto;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	Using where with pushed condition; Using filesort
select auto from t1 where
"aaaa" not in(string) and 
"aaaa" not in(vstring) and 
0xAAAA not in(bin) and 
0xAAAA not in(vbin) and 
(-1 not in(tiny)) and
(-1 not in(short)) and
(-1 not in(medium)) and
(-1 not in(long_int)) and
(-1 not in(longlong)) and
1 not in(utiny) and 
1 not in(ushort) and 
1 not in(umedium) and 
1 not in(ulong) and 
1 not in(ulonglong) and 
/* b'001' not in(bits) and */
'one' not in(options) and 
'one' not in(flags) and 
'1901-01-01' not in(date_field) and
'1901' not in(year_field) and
'01:01:01' not in(time_field) and 
'1901-01-01 01:01:01' not in(date_time) 
order by auto;
auto
2
3
4
1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703
update t1
set medium = 17
where 
string = "aaaa" and 
vstring = "aaaa" and 
bin = 0xAAAA and 
vbin = 0xAAAA and
tiny = -1 and 
short = -1 and 
medium = -1 and 
long_int = -1 and 
longlong = -1 and 
real_float > 1.0 and real_float < 2.0 and 
real_double > 1.0 and real_double < 2.0 and
real_decimal > 1.0 and real_decimal < 2.0 and
utiny = 1 and 
ushort = 1 and 
umedium = 1 and 
ulong = 1 and 
ulonglong = 1 and 
/* bits = b'001' and */
options = 'one' and 
flags = 'one' and 
date_field = '1901-01-01' and
year_field = '1901' and
time_field = '01:01:01' and 
date_time = '1901-01-01 01:01:01';
delete from t1 
where
string = "aaaa" and 
vstring = "aaaa" and 
bin = 0xAAAA and 
vbin = 0xAAAA and
tiny = -1 and 
short = -1 and 
medium = 17 and 
long_int = -1 and 
longlong = -1 and 
real_float > 1.0 and real_float < 2.0 and 
real_double > 1.0 and real_double < 2.0 and
real_decimal > 1.0 and real_decimal < 2.0 and
utiny = 1 and 
ushort = 1 and 
umedium = 1 and 
ulong = 1 and 
ulonglong = 1 and 
/* bits = b'001' and */
options = 'one' and 
flags = 'one' and 
date_field = '1901-01-01' and
year_field = '1901' and
time_field = '01:01:01' and 
date_time = '1901-01-01 01:01:01';
select count(*) from t1;
count(*)
3
1704 1705 1706 1707
explain 
select * from t2 where attr3 is null or attr1 > 2 and pk1= 3 order by pk1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	ALL	PRIMARY	NULL	NULL	NULL	6	Using where with pushed condition; Using filesort
mskold@mysql.com's avatar
mskold@mysql.com committed
1708
select * from t2 where attr3 is null or attr1 > 2 and pk1= 3 order by pk1;
1709 1710 1711
pk1	attr1	attr2	attr3
2	2	NULL	NULL
3	3	3	d
1712 1713 1714 1715
explain
select * from t2 where attr3 is not null and attr1 > 2 order by pk1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	6	Using where with pushed condition; Using filesort
1716 1717 1718 1719 1720
select * from t2 where attr3 is not null and attr1 > 2 order by pk1;
pk1	attr1	attr2	attr3
3	3	3	d
4	4	4	e
5	5	5	f
1721 1722 1723 1724
explain
select * from t3 where attr2 >  9223372036854775803 and attr3 != 3 order by pk1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t3	ALL	NULL	NULL	NULL	NULL	6	Using where with pushed condition; Using filesort
mskold@mysql.com's avatar
mskold@mysql.com committed
1725
select * from t3 where attr2 >  9223372036854775803 and attr3 != 3 order by pk1;
1726 1727 1728 1729
pk1	attr1	attr2	attr3	attr4
2	2	9223372036854775804	2	c
4	4	9223372036854775806	4	e
5	5	9223372036854775807	5	f
1730 1731 1732 1733 1734
explain
select * from t2,t3 where t2.attr1 < 1 and t2.attr2 = t3.attr2 and t3.attr1 < 5 order by t2.pk1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	6	Using where with pushed condition; Using temporary; Using filesort
1	SIMPLE	t3	ALL	NULL	NULL	NULL	NULL	6	Using where with pushed condition
1735
select * from t2,t3 where t2.attr1 < 1 and t2.attr2 = t3.attr2 and t3.attr1 < 5 order by t2.pk1;
1736
pk1	attr1	attr2	attr3	pk1	attr1	attr2	attr3	attr4
1737
0	0	0	a	0	0	0	0	a
1738 1739 1740 1741
explain
select * from t4 where attr1 < 5 and attr2 > 9223372036854775803 and attr3 != 3 order by t4.pk1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t4	range	attr1	attr1	4	NULL	10	Using where with pushed condition; Using filesort
mskold@mysql.com's avatar
mskold@mysql.com committed
1742 1743 1744 1745
select * from t4 where attr1 < 5 and attr2 > 9223372036854775803 and attr3 != 3 order by t4.pk1;
pk1	attr1	attr2	attr3	attr4
2	2	9223372036854775804	2	c
4	4	9223372036854775806	4	e
1746 1747 1748 1749 1750
explain
select * from t3,t4 where t4.attr1 > 1 and t4.attr2 = t3.attr2 and t4.attr3 < 5 order by t4.pk1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t4	range	attr1	attr1	4	NULL	10	Using where with pushed condition; Using temporary; Using filesort
1	SIMPLE	t3	ALL	NULL	NULL	NULL	NULL	6	Using where
mskold@mysql.com's avatar
mskold@mysql.com committed
1751 1752 1753 1754 1755
select * from t3,t4 where t4.attr1 > 1 and t4.attr2 = t3.attr2 and t4.attr3 < 5 order by t4.pk1;
pk1	attr1	attr2	attr3	attr4	pk1	attr1	attr2	attr3	attr4
2	2	9223372036854775804	2	c	2	2	9223372036854775804	2	c
3	3	9223372036854775805	3	d	3	3	9223372036854775805	3	d
4	4	9223372036854775806	4	e	4	4	9223372036854775806	4	e
1756
explain
1757
select auto from t1 where string = "aaaa" collate latin1_general_ci order by auto;
1758
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1759
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3	Using where; Using filesort
1760
explain
1761
select * from t2 where (attr1 < 2) = (attr2 < 2) order by pk1;
1762
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1763
1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	6	Using where; Using filesort
1764 1765 1766 1767 1768
explain
select * from t3 left join t4 on t4.attr2 = t3.attr2 where t4.attr1 > 1 and t4.attr3 < 5 or t4.attr1 is null order by t4.pk1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t3	ALL	NULL	NULL	NULL	NULL	6	Using temporary; Using filesort
1	SIMPLE	t4	ALL	NULL	NULL	NULL	NULL	6	Using where
1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784
create table t5 (a int primary key auto_increment, b tinytext not null) 
engine = ndb;
insert into t5 (b) values ('jonas'), ('jensing'), ('johan');
set engine_condition_pushdown = off;
select * from t5 where b like '%jo%' order by a;
a	b
1	jonas
3	johan
set engine_condition_pushdown = on;
explain select * from t5 where b like '%jo%';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t5	ALL	NULL	NULL	NULL	NULL	3	Using where
select * from t5 where b like '%jo%' order by a;
a	b
1	jonas
3	johan
1785
set engine_condition_pushdown = off;
1786
select auto from t1 where date_time like '1902-02-02 %' order by auto;
1787 1788
auto
2
1789
select auto from t1 where date_time not like '1902-02-02 %' order by auto;
1790 1791 1792 1793 1794 1795 1796
auto
3
4
set engine_condition_pushdown = on;
explain select auto from t1 where date_time like '1902-02-02 %';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3	Using where
1797
select auto from t1 where date_time like '1902-02-02 %' order by auto;
1798 1799 1800 1801 1802
auto
2
explain select auto from t1 where date_time not like '1902-02-02 %';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3	Using where
1803
select auto from t1 where date_time not like '1902-02-02 %' order by auto;
1804 1805 1806
auto
3
4
1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866
drop table t1;
create table t1 (a int, b varchar(3), primary key using hash(a))
engine=ndb;
insert into t1 values (1,'a'), (2,'ab'), (3,'abc');
set engine_condition_pushdown = off;
select * from t1 where b like 'ab';
a	b
2	ab
select * from t1 where b like 'ab' or b like 'ab';
a	b
2	ab
select * from t1 where b like 'abc';
a	b
3	abc
select * from t1 where b like 'abc' or b like 'abc';
a	b
3	abc
set engine_condition_pushdown = on;
select * from t1 where b like 'ab';
a	b
2	ab
select * from t1 where b like 'ab' or b like 'ab';
a	b
2	ab
select * from t1 where b like 'abc';
a	b
3	abc
select * from t1 where b like 'abc' or b like 'abc';
a	b
3	abc
drop table t1;
create table t1 (a int, b char(3), primary key using hash(a))
engine=ndb;
insert into t1 values (1,'a'), (2,'ab'), (3,'abc');
set engine_condition_pushdown = off;
select * from t1 where b like 'ab';
a	b
2	ab
select * from t1 where b like 'ab' or b like 'ab';
a	b
2	ab
select * from t1 where b like 'abc';
a	b
3	abc
select * from t1 where b like 'abc' or b like 'abc';
a	b
3	abc
set engine_condition_pushdown = on;
select * from t1 where b like 'ab';
a	b
2	ab
select * from t1 where b like 'ab' or b like 'ab';
a	b
2	ab
select * from t1 where b like 'abc';
a	b
3	abc
select * from t1 where b like 'abc' or b like 'abc';
a	b
3	abc
1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890
drop table t1;
create table  t1 ( fname varchar(255), lname varchar(255) )
engine=ndbcluster;
insert into t1 values ("Young","Foo");
set engine_condition_pushdown = 0;
SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
fname	lname
Young	Foo
set engine_condition_pushdown = 1;
SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
fname	lname
Young	Foo
insert into t1 values ("aaa", "aaa");
insert into t1 values ("bbb", "bbb");
insert into t1 values ("ccc", "ccc");
insert into t1 values ("ddd", "ddd");
set engine_condition_pushdown = 0;
SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
fname	lname
Young	Foo
set engine_condition_pushdown = 1;
SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
fname	lname
Young	Foo
1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912
drop table t1;
create table t1 (a int, b int, c int, d int, primary key using hash(a))
engine=ndbcluster;
insert into t1 values (10,1,100,0+0x1111);
insert into t1 values (20,2,200,0+0x2222);
insert into t1 values (30,3,300,0+0x3333);
insert into t1 values (40,4,400,0+0x4444);
insert into t1 values (50,5,500,0+0x5555);
set engine_condition_pushdown = on;
select a,b,d from t1
where b in (0,1,2,5)
order by b;
a	b	d
10	1	4369
20	2	8738
50	5	21845
a	b	d
10	1	4369
20	2	8738
50	5	21845
Warnings:
Warning	4294	Scan filter is too large, discarded
mskold@mysql.com's avatar
mskold@mysql.com committed
1913
set engine_condition_pushdown = @old_ecpd;
1914
DROP TABLE t1,t2,t3,t4,t5;