Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
6950d57f
Commit
6950d57f
authored
Mar 14, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal:/home/bk/mysql-5.0
into serg.mylan:/usr/home/serg/Abk/mysql-5.0
parents
df93b4fa
79a005fe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
788 additions
and
11 deletions
+788
-11
mysql-test/r/ndb_condition_pushdown.result
mysql-test/r/ndb_condition_pushdown.result
+398
-8
mysql-test/t/ndb_condition_pushdown.test
mysql-test/t/ndb_condition_pushdown.test
+371
-0
sql/set_var.cc
sql/set_var.cc
+2
-0
sql/sql_select.cc
sql/sql_select.cc
+17
-3
No files found.
mysql-test/r/ndb_condition_pushdown.result
View file @
6950d57f
...
...
@@ -278,6 +278,35 @@ pk1 attr1 attr2 attr3 attr4 pk1 attr1 attr2 attr3 attr4
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;
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
string = "aaaa" and
vstring = "aaaa" and
...
...
@@ -306,6 +335,35 @@ date_time = '1901-01-01 01:01:01'
order by auto;
auto
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
string != "aaaa" and
vstring != "aaaa" and
...
...
@@ -336,6 +394,35 @@ auto
2
3
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
string > "aaaa" and
vstring > "aaaa" and
...
...
@@ -366,6 +453,35 @@ auto
2
3
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
string >= "aaaa" and
vstring >= "aaaa" and
...
...
@@ -397,6 +513,35 @@ auto
2
3
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
string < "dddd" and
vstring < "dddd" and
...
...
@@ -427,6 +572,35 @@ auto
1
2
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
string <= "dddd" and
vstring <= "dddd" and
...
...
@@ -459,6 +633,35 @@ auto
3
4
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
string = "aaaa" and
vstring = "aaaa" and
...
...
@@ -487,6 +690,35 @@ date_time = '1901-01-01 01:01:01'
order by auto;
auto
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
string != "aaaa" and
vstring != "aaaa" and
...
...
@@ -517,6 +749,35 @@ auto
2
3
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
string > "aaaa" and
vstring > "aaaa" and
...
...
@@ -547,6 +808,35 @@ auto
2
3
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
string >= "aaaa" and
vstring >= "aaaa" and
...
...
@@ -578,6 +868,35 @@ auto
2
3
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
string < "dddd" and
vstring < "dddd" and
...
...
@@ -608,6 +927,35 @@ auto
1
2
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
string <= "dddd" and
vstring <= "dddd" and
...
...
@@ -639,6 +987,15 @@ auto
2
3
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
string like "b%" and
vstring like "b%" and
...
...
@@ -647,6 +1004,15 @@ vbin like concat(0xBB, '%')
order by auto;
auto
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
string not like "b%" and
vstring not like "b%" and
...
...
@@ -657,41 +1023,65 @@ auto
1
3
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;
pk1 attr1 attr2 attr3
2 2 NULL NULL
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;
pk1 attr1 attr2 attr3
3 3 3 d
4 4 4 e
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;
pk1 attr1 attr2 attr3 attr4
2 2 9223372036854775804 2 c
4 4 9223372036854775806 4 e
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;
pk1 attr1 attr2 attr3 pk1 attr1 attr2 attr3 attr4
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;
pk1 attr1 attr2 attr3 attr4
2 2 9223372036854775804 2 c
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;
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
explain
select auto from t1 where string = "aaaa" collate latin1_general_ci order by auto;
auto
1
id select_type table type possible_keys key key_len ref rows Extra
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;
pk1 attr1 attr2 attr3
0 0 0 a
1 1 1 b
3 3 3 d
4 4 4 e
5 5 5 f
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using filesort
set engine_condition_pushdown = @old_ecpd;
DROP TABLE t1,t2,t3,t4;
mysql-test/t/ndb_condition_pushdown.test
View file @
6950d57f
...
...
@@ -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
;
# Test all types and compare operators
explain
select
auto
from
t1
where
string
=
"aaaa"
and
vstring
=
"aaaa"
and
...
...
@@ -286,6 +287,61 @@ time_field = '01:01:01' and
date_time
=
'1901-01-01 01:01:01'
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
string
!=
"aaaa"
and
vstring
!=
"aaaa"
and
...
...
@@ -313,6 +369,34 @@ 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.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
string
>
"aaaa"
and
vstring
>
"aaaa"
and
...
...
@@ -340,6 +424,7 @@ 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
...
...
@@ -367,6 +452,34 @@ time_field >= '01:01:01' and
date_time
>=
'1901-01-01 01:01:01'
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
string
<
"dddd"
and
vstring
<
"dddd"
and
...
...
@@ -394,6 +507,61 @@ time_field < '04:04:04' and
date_time
<
'1904-04-04 04:04:04'
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
string
<=
"dddd"
and
vstring
<=
"dddd"
and
...
...
@@ -425,6 +593,7 @@ order by auto;
create
index
medium_index
on
t1
(
medium
);
# Test all types and compare operators
explain
select
auto
from
t1
where
string
=
"aaaa"
and
vstring
=
"aaaa"
and
...
...
@@ -452,6 +621,61 @@ time_field = '01:01:01' and
date_time
=
'1901-01-01 01:01:01'
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
string
!=
"aaaa"
and
vstring
!=
"aaaa"
and
...
...
@@ -479,6 +703,7 @@ 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
...
...
@@ -506,6 +731,61 @@ time_field > '01:01:01' and
date_time
>
'1901-01-01 01:01:01'
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
string
>=
"aaaa"
and
vstring
>=
"aaaa"
and
...
...
@@ -533,6 +813,34 @@ time_field >= '01:01:01' and
date_time
>=
'1901-01-01 01:01:01'
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
string
<
"dddd"
and
vstring
<
"dddd"
and
...
...
@@ -560,6 +868,34 @@ 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
string
<=
"dddd"
and
vstring
<=
"dddd"
and
...
...
@@ -588,6 +924,7 @@ date_time <= '1904-04-04 04:04:04'
order
by
auto
;
# Test LIKE/NOT LIKE
explain
select
auto
from
t1
where
string
like
"b%"
and
vstring
like
"b%"
and
...
...
@@ -595,6 +932,21 @@ bin like concat(0xBB, '%') and
vbin
like
concat
(
0xBB
,
'%'
)
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
string
not
like
"b%"
and
vstring
not
like
"b%"
and
...
...
@@ -603,15 +955,34 @@ vbin not like concat(0xBB, '%')
order
by
auto
;
# 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
;
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
;
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
;
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
;
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
;
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
;
# 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
;
explain
select
*
from
t2
where
(
attr1
<
2
)
=
(
attr2
<
2
)
order
by
pk1
;
set
engine_condition_pushdown
=
@
old_ecpd
;
...
...
sql/set_var.cc
View file @
6950d57f
...
...
@@ -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
)
{
#ifdef USING_TRANSACTIONS
if
(
type
!=
OPT_GLOBAL
)
reset_root_defaults
(
&
thd
->
transaction
.
mem_root
,
thd
->
variables
.
trans_alloc_block_size
,
thd
->
variables
.
trans_prealloc_size
);
#endif
}
...
...
sql/sql_select.cc
View file @
6950d57f
...
...
@@ -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
)))
DBUG_RETURN
(
1
);
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
;
/* Push condition to handler */
...
...
@@ -5433,7 +5433,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
join
->
thd
->
memdup
((
gptr
)
sel
,
sizeof
(
SQL_SELECT
));
tab
->
cache
.
select
->
cond
=
tmp
;
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
))
{
/* Push condition to handler */
...
...
@@ -13008,7 +13008,21 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
extra
.
append
(
')'
);
}
else
if
(
tab
->
select
->
cond
)
extra
.
append
(
"; Using where"
);
{
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"
);
}
}
if
(
key_read
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment