Commit 6950d57f authored by unknown's avatar unknown

Merge bk-internal:/home/bk/mysql-5.0

into serg.mylan:/usr/home/serg/Abk/mysql-5.0

parents df93b4fa 79a005fe
...@@ -278,6 +278,35 @@ pk1 attr1 attr2 attr3 attr4 pk1 attr1 attr2 attr3 attr4 ...@@ -278,6 +278,35 @@ pk1 attr1 attr2 attr3 attr4 pk1 attr1 attr2 attr3 attr4
3 3 9223372036854775805 3 d 3 3 9223372036854775805 3 d 3 3 9223372036854775805 3 d 3 3 9223372036854775805 3 d
4 4 9223372036854775806 4 e 4 4 9223372036854775806 4 e 4 4 9223372036854775806 4 e 4 4 9223372036854775806 4 e
set engine_condition_pushdown = on; set engine_condition_pushdown = on;
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
select auto from t1 where select auto from t1 where
string = "aaaa" and string = "aaaa" and
vstring = "aaaa" and vstring = "aaaa" and
...@@ -306,6 +335,35 @@ date_time = '1901-01-01 01:01:01' ...@@ -306,6 +335,35 @@ date_time = '1901-01-01 01:01:01'
order by auto; order by auto;
auto auto
1 1
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
select auto from t1 where select auto from t1 where
string != "aaaa" and string != "aaaa" and
vstring != "aaaa" and vstring != "aaaa" and
...@@ -336,6 +394,35 @@ auto ...@@ -336,6 +394,35 @@ auto
2 2
3 3
4 4
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
select auto from t1 where select auto from t1 where
string > "aaaa" and string > "aaaa" and
vstring > "aaaa" and vstring > "aaaa" and
...@@ -366,6 +453,35 @@ auto ...@@ -366,6 +453,35 @@ auto
2 2
3 3
4 4
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
select auto from t1 where select auto from t1 where
string >= "aaaa" and string >= "aaaa" and
vstring >= "aaaa" and vstring >= "aaaa" and
...@@ -397,6 +513,35 @@ auto ...@@ -397,6 +513,35 @@ auto
2 2
3 3
4 4
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
select auto from t1 where select auto from t1 where
string < "dddd" and string < "dddd" and
vstring < "dddd" and vstring < "dddd" and
...@@ -427,6 +572,35 @@ auto ...@@ -427,6 +572,35 @@ auto
1 1
2 2
3 3
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
select auto from t1 where select auto from t1 where
string <= "dddd" and string <= "dddd" and
vstring <= "dddd" and vstring <= "dddd" and
...@@ -459,6 +633,35 @@ auto ...@@ -459,6 +633,35 @@ auto
3 3
4 4
create index medium_index on t1(medium); create index medium_index on t1(medium);
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
select auto from t1 where select auto from t1 where
string = "aaaa" and string = "aaaa" and
vstring = "aaaa" and vstring = "aaaa" and
...@@ -487,6 +690,35 @@ date_time = '1901-01-01 01:01:01' ...@@ -487,6 +690,35 @@ date_time = '1901-01-01 01:01:01'
order by auto; order by auto;
auto auto
1 1
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
select auto from t1 where select auto from t1 where
string != "aaaa" and string != "aaaa" and
vstring != "aaaa" and vstring != "aaaa" and
...@@ -517,6 +749,35 @@ auto ...@@ -517,6 +749,35 @@ auto
2 2
3 3
4 4
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
select auto from t1 where select auto from t1 where
string > "aaaa" and string > "aaaa" and
vstring > "aaaa" and vstring > "aaaa" and
...@@ -547,6 +808,35 @@ auto ...@@ -547,6 +808,35 @@ auto
2 2
3 3
4 4
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
select auto from t1 where select auto from t1 where
string >= "aaaa" and string >= "aaaa" and
vstring >= "aaaa" and vstring >= "aaaa" and
...@@ -578,6 +868,35 @@ auto ...@@ -578,6 +868,35 @@ auto
2 2
3 3
4 4
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
select auto from t1 where select auto from t1 where
string < "dddd" and string < "dddd" and
vstring < "dddd" and vstring < "dddd" and
...@@ -608,6 +927,35 @@ auto ...@@ -608,6 +927,35 @@ auto
1 1
2 2
3 3
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
select auto from t1 where select auto from t1 where
string <= "dddd" and string <= "dddd" and
vstring <= "dddd" and vstring <= "dddd" and
...@@ -639,6 +987,15 @@ auto ...@@ -639,6 +987,15 @@ auto
2 2
3 3
4 4
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
select auto from t1 where select auto from t1 where
string like "b%" and string like "b%" and
vstring like "b%" and vstring like "b%" and
...@@ -647,6 +1004,15 @@ vbin like concat(0xBB, '%') ...@@ -647,6 +1004,15 @@ vbin like concat(0xBB, '%')
order by auto; order by auto;
auto auto
2 2
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
select auto from t1 where select auto from t1 where
string not like "b%" and string not like "b%" and
vstring not like "b%" and vstring not like "b%" and
...@@ -657,41 +1023,65 @@ auto ...@@ -657,41 +1023,65 @@ auto
1 1
3 3
4 4
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
select * from t2 where attr3 is null or attr1 > 2 and pk1= 3 order by pk1; select * from t2 where attr3 is null or attr1 > 2 and pk1= 3 order by pk1;
pk1 attr1 attr2 attr3 pk1 attr1 attr2 attr3
2 2 NULL NULL 2 2 NULL NULL
3 3 3 d 3 3 3 d
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
select * from t2 where attr3 is not null and attr1 > 2 order by pk1; select * from t2 where attr3 is not null and attr1 > 2 order by pk1;
pk1 attr1 attr2 attr3 pk1 attr1 attr2 attr3
3 3 3 d 3 3 3 d
4 4 4 e 4 4 4 e
5 5 5 f 5 5 5 f
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
select * from t3 where attr2 > 9223372036854775803 and attr3 != 3 order by pk1; select * from t3 where attr2 > 9223372036854775803 and attr3 != 3 order by pk1;
pk1 attr1 attr2 attr3 attr4 pk1 attr1 attr2 attr3 attr4
2 2 9223372036854775804 2 c 2 2 9223372036854775804 2 c
4 4 9223372036854775806 4 e 4 4 9223372036854775806 4 e
5 5 9223372036854775807 5 f 5 5 9223372036854775807 5 f
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
select * from t2,t3 where t2.attr1 < 1 and t2.attr2 = t3.attr2 and t3.attr1 < 5 order by t2.pk1; select * from t2,t3 where t2.attr1 < 1 and t2.attr2 = t3.attr2 and t3.attr1 < 5 order by t2.pk1;
pk1 attr1 attr2 attr3 pk1 attr1 attr2 attr3 attr4 pk1 attr1 attr2 attr3 pk1 attr1 attr2 attr3 attr4
0 0 0 a 0 0 0 0 a 0 0 0 a 0 0 0 0 a
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
select * from t4 where attr1 < 5 and attr2 > 9223372036854775803 and attr3 != 3 order by t4.pk1; select * from t4 where attr1 < 5 and attr2 > 9223372036854775803 and attr3 != 3 order by t4.pk1;
pk1 attr1 attr2 attr3 attr4 pk1 attr1 attr2 attr3 attr4
2 2 9223372036854775804 2 c 2 2 9223372036854775804 2 c
4 4 9223372036854775806 4 e 4 4 9223372036854775806 4 e
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
select * from t3,t4 where t4.attr1 > 1 and t4.attr2 = t3.attr2 and t4.attr3 < 5 order by t4.pk1; 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 pk1 attr1 attr2 attr3 attr4 pk1 attr1 attr2 attr3 attr4
2 2 9223372036854775804 2 c 2 2 9223372036854775804 2 c 2 2 9223372036854775804 2 c 2 2 9223372036854775804 2 c
3 3 9223372036854775805 3 d 3 3 9223372036854775805 3 d 3 3 9223372036854775805 3 d 3 3 9223372036854775805 3 d
4 4 9223372036854775806 4 e 4 4 9223372036854775806 4 e 4 4 9223372036854775806 4 e 4 4 9223372036854775806 4 e
explain
select auto from t1 where string = "aaaa" collate latin1_general_ci order by auto; select auto from t1 where string = "aaaa" collate latin1_general_ci order by auto;
auto id select_type table type possible_keys key key_len ref rows Extra
1 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where; Using filesort
explain
select * from t2 where (attr1 < 2) = (attr2 < 2) order by pk1; select * from t2 where (attr1 < 2) = (attr2 < 2) order by pk1;
pk1 attr1 attr2 attr3 id select_type table type possible_keys key key_len ref rows Extra
0 0 0 a 1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using filesort
1 1 1 b
3 3 3 d
4 4 4 e
5 5 5 f
set engine_condition_pushdown = @old_ecpd; set engine_condition_pushdown = @old_ecpd;
DROP TABLE t1,t2,t3,t4; DROP TABLE t1,t2,t3,t4;
...@@ -259,6 +259,7 @@ select * from t3,t4 where t4.attr1 > 1 and t4.attr2 = t3.attr2 and t4.attr3 < 5 ...@@ -259,6 +259,7 @@ select * from t3,t4 where t4.attr1 > 1 and t4.attr2 = t3.attr2 and t4.attr3 < 5
set engine_condition_pushdown = on; set engine_condition_pushdown = on;
# Test all types and compare operators # Test all types and compare operators
explain
select auto from t1 where select auto from t1 where
string = "aaaa" and string = "aaaa" and
vstring = "aaaa" and vstring = "aaaa" and
...@@ -286,6 +287,61 @@ time_field = '01:01:01' and ...@@ -286,6 +287,61 @@ time_field = '01:01:01' and
date_time = '1901-01-01 01:01:01' date_time = '1901-01-01 01:01:01'
order by auto; order by auto;
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;
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;
select auto from t1 where select auto from t1 where
string != "aaaa" and string != "aaaa" and
vstring != "aaaa" and vstring != "aaaa" and
...@@ -313,6 +369,34 @@ time_field != '01:01:01' and ...@@ -313,6 +369,34 @@ time_field != '01:01:01' and
date_time != '1901-01-01 01:01:01' date_time != '1901-01-01 01:01:01'
order by auto; order by auto;
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;
select auto from t1 where select auto from t1 where
string > "aaaa" and string > "aaaa" and
vstring > "aaaa" and vstring > "aaaa" and
...@@ -340,6 +424,7 @@ time_field > '01:01:01' and ...@@ -340,6 +424,7 @@ time_field > '01:01:01' and
date_time > '1901-01-01 01:01:01' date_time > '1901-01-01 01:01:01'
order by auto; order by auto;
explain
select auto from t1 where select auto from t1 where
string >= "aaaa" and string >= "aaaa" and
vstring >= "aaaa" and vstring >= "aaaa" and
...@@ -367,6 +452,34 @@ time_field >= '01:01:01' and ...@@ -367,6 +452,34 @@ time_field >= '01:01:01' and
date_time >= '1901-01-01 01:01:01' date_time >= '1901-01-01 01:01:01'
order by auto; order by auto;
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;
explain
select auto from t1 where select auto from t1 where
string < "dddd" and string < "dddd" and
vstring < "dddd" and vstring < "dddd" and
...@@ -394,6 +507,61 @@ time_field < '04:04:04' and ...@@ -394,6 +507,61 @@ time_field < '04:04:04' and
date_time < '1904-04-04 04:04:04' date_time < '1904-04-04 04:04:04'
order by auto; order by auto;
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;
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;
select auto from t1 where select auto from t1 where
string <= "dddd" and string <= "dddd" and
vstring <= "dddd" and vstring <= "dddd" and
...@@ -425,6 +593,7 @@ order by auto; ...@@ -425,6 +593,7 @@ order by auto;
create index medium_index on t1(medium); create index medium_index on t1(medium);
# Test all types and compare operators # Test all types and compare operators
explain
select auto from t1 where select auto from t1 where
string = "aaaa" and string = "aaaa" and
vstring = "aaaa" and vstring = "aaaa" and
...@@ -452,6 +621,61 @@ time_field = '01:01:01' and ...@@ -452,6 +621,61 @@ time_field = '01:01:01' and
date_time = '1901-01-01 01:01:01' date_time = '1901-01-01 01:01:01'
order by auto; order by auto;
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;
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;
select auto from t1 where select auto from t1 where
string != "aaaa" and string != "aaaa" and
vstring != "aaaa" and vstring != "aaaa" and
...@@ -479,6 +703,7 @@ time_field != '01:01:01' and ...@@ -479,6 +703,7 @@ time_field != '01:01:01' and
date_time != '1901-01-01 01:01:01' date_time != '1901-01-01 01:01:01'
order by auto; order by auto;
explain
select auto from t1 where select auto from t1 where
string > "aaaa" and string > "aaaa" and
vstring > "aaaa" and vstring > "aaaa" and
...@@ -506,6 +731,61 @@ time_field > '01:01:01' and ...@@ -506,6 +731,61 @@ time_field > '01:01:01' and
date_time > '1901-01-01 01:01:01' date_time > '1901-01-01 01:01:01'
order by auto; order by auto;
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;
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;
select auto from t1 where select auto from t1 where
string >= "aaaa" and string >= "aaaa" and
vstring >= "aaaa" and vstring >= "aaaa" and
...@@ -533,6 +813,34 @@ time_field >= '01:01:01' and ...@@ -533,6 +813,34 @@ time_field >= '01:01:01' and
date_time >= '1901-01-01 01:01:01' date_time >= '1901-01-01 01:01:01'
order by auto; order by auto;
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;
select auto from t1 where select auto from t1 where
string < "dddd" and string < "dddd" and
vstring < "dddd" and vstring < "dddd" and
...@@ -560,6 +868,34 @@ time_field < '04:04:04' and ...@@ -560,6 +868,34 @@ time_field < '04:04:04' and
date_time < '1904-04-04 04:04:04' date_time < '1904-04-04 04:04:04'
order by auto; order by auto;
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;
select auto from t1 where select auto from t1 where
string <= "dddd" and string <= "dddd" and
vstring <= "dddd" and vstring <= "dddd" and
...@@ -588,6 +924,7 @@ date_time <= '1904-04-04 04:04:04' ...@@ -588,6 +924,7 @@ date_time <= '1904-04-04 04:04:04'
order by auto; order by auto;
# Test LIKE/NOT LIKE # Test LIKE/NOT LIKE
explain
select auto from t1 where select auto from t1 where
string like "b%" and string like "b%" and
vstring like "b%" and vstring like "b%" and
...@@ -595,6 +932,21 @@ bin like concat(0xBB, '%') and ...@@ -595,6 +932,21 @@ bin like concat(0xBB, '%') and
vbin like concat(0xBB, '%') vbin like concat(0xBB, '%')
order by auto; order by auto;
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;
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;
select auto from t1 where select auto from t1 where
string not like "b%" and string not like "b%" and
vstring not like "b%" and vstring not like "b%" and
...@@ -603,15 +955,34 @@ vbin not like concat(0xBB, '%') ...@@ -603,15 +955,34 @@ vbin not like concat(0xBB, '%')
order by auto; order by auto;
# Various tests # Various tests
explain
select * from t2 where attr3 is null or attr1 > 2 and pk1= 3 order by pk1;
select * from t2 where attr3 is null or attr1 > 2 and pk1= 3 order by pk1; select * from t2 where attr3 is null or attr1 > 2 and pk1= 3 order by pk1;
explain
select * from t2 where attr3 is not null and attr1 > 2 order by pk1;
select * from t2 where attr3 is not null and attr1 > 2 order by pk1; select * from t2 where attr3 is not null and attr1 > 2 order by pk1;
explain
select * from t3 where attr2 > 9223372036854775803 and attr3 != 3 order by pk1; select * from t3 where attr2 > 9223372036854775803 and attr3 != 3 order by pk1;
select * from t3 where attr2 > 9223372036854775803 and attr3 != 3 order by pk1;
explain
select * from t2,t3 where t2.attr1 < 1 and t2.attr2 = t3.attr2 and t3.attr1 < 5 order by t2.pk1; select * from t2,t3 where t2.attr1 < 1 and t2.attr2 = t3.attr2 and t3.attr1 < 5 order by t2.pk1;
select * from t2,t3 where t2.attr1 < 1 and t2.attr2 = t3.attr2 and t3.attr1 < 5 order by t2.pk1;
explain
select * from t4 where attr1 < 5 and attr2 > 9223372036854775803 and attr3 != 3 order by t4.pk1;
select * from t4 where attr1 < 5 and attr2 > 9223372036854775803 and attr3 != 3 order by t4.pk1; select * from t4 where attr1 < 5 and attr2 > 9223372036854775803 and attr3 != 3 order by t4.pk1;
explain
select * from t3,t4 where t4.attr1 > 1 and t4.attr2 = t3.attr2 and t4.attr3 < 5 order by t4.pk1;
select * from t3,t4 where t4.attr1 > 1 and t4.attr2 = t3.attr2 and t4.attr3 < 5 order by t4.pk1; select * from t3,t4 where t4.attr1 > 1 and t4.attr2 = t3.attr2 and t4.attr3 < 5 order by t4.pk1;
# Some tests that are currently not supported and should not push condition # Some tests that are currently not supported and should not push condition
explain
select auto from t1 where string = "aaaa" collate latin1_general_ci order by auto; select auto from t1 where string = "aaaa" collate latin1_general_ci order by auto;
explain
select * from t2 where (attr1 < 2) = (attr2 < 2) order by pk1; select * from t2 where (attr1 < 2) = (attr2 < 2) order by pk1;
set engine_condition_pushdown = @old_ecpd; set engine_condition_pushdown = @old_ecpd;
......
...@@ -1319,10 +1319,12 @@ static void fix_thd_mem_root(THD *thd, enum_var_type type) ...@@ -1319,10 +1319,12 @@ static void fix_thd_mem_root(THD *thd, enum_var_type type)
static void fix_trans_mem_root(THD *thd, enum_var_type type) static void fix_trans_mem_root(THD *thd, enum_var_type type)
{ {
#ifdef USING_TRANSACTIONS
if (type != OPT_GLOBAL) if (type != OPT_GLOBAL)
reset_root_defaults(&thd->transaction.mem_root, reset_root_defaults(&thd->transaction.mem_root,
thd->variables.trans_alloc_block_size, thd->variables.trans_alloc_block_size,
thd->variables.trans_prealloc_size); thd->variables.trans_prealloc_size);
#endif
} }
......
...@@ -5305,7 +5305,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) ...@@ -5305,7 +5305,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
if (!(tmp= add_found_match_trig_cond(first_inner_tab, tmp, 0))) if (!(tmp= add_found_match_trig_cond(first_inner_tab, tmp, 0)))
DBUG_RETURN(1); DBUG_RETURN(1);
tab->select_cond=sel->cond=tmp; tab->select_cond=sel->cond=tmp;
if (current_thd->variables.engine_condition_pushdown) if (join->thd->variables.engine_condition_pushdown)
{ {
tab->table->file->pushed_cond= NULL; tab->table->file->pushed_cond= NULL;
/* Push condition to handler */ /* Push condition to handler */
...@@ -5433,7 +5433,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) ...@@ -5433,7 +5433,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
join->thd->memdup((gptr) sel, sizeof(SQL_SELECT)); join->thd->memdup((gptr) sel, sizeof(SQL_SELECT));
tab->cache.select->cond=tmp; tab->cache.select->cond=tmp;
tab->cache.select->read_tables=join->const_table_map; tab->cache.select->read_tables=join->const_table_map;
if (current_thd->variables.engine_condition_pushdown && if (join->thd->variables.engine_condition_pushdown &&
(!tab->table->file->pushed_cond)) (!tab->table->file->pushed_cond))
{ {
/* Push condition to handler */ /* Push condition to handler */
...@@ -13008,8 +13008,22 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, ...@@ -13008,8 +13008,22 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
extra.append(')'); extra.append(')');
} }
else if (tab->select->cond) else if (tab->select->cond)
{
const COND *pushed_cond= tab->table->file->pushed_cond;
if (thd->variables.engine_condition_pushdown && pushed_cond)
{
extra.append("; Using where with pushed condition");
if (thd->lex->describe & DESCRIBE_EXTENDED)
{
extra.append(": ");
((COND *)pushed_cond)->print(&extra);
}
}
else
extra.append("; Using where"); extra.append("; Using where");
} }
}
if (key_read) if (key_read)
{ {
if (quick_type == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX) if (quick_type == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment