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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
f221f10a
Commit
f221f10a
authored
Feb 17, 2020
by
Varun Gupta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing tests for sort nest
parent
0aa6bde0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
180 deletions
+15
-180
mysql-test/main/sort_nest.result
mysql-test/main/sort_nest.result
+7
-125
mysql-test/main/sort_nest.test
mysql-test/main/sort_nest.test
+1
-18
mysql-test/main/sort_nest_dbt3.result
mysql-test/main/sort_nest_dbt3.result
+3
-18
mysql-test/main/sort_nest_dbt3.test
mysql-test/main/sort_nest_dbt3.test
+1
-1
mysql-test/main/sort_nest_dbt3_innodb.result
mysql-test/main/sort_nest_dbt3_innodb.result
+3
-18
No files found.
mysql-test/main/sort_nest.result
View file @
f221f10a
...
...
@@ -1685,7 +1685,7 @@ WHERE a=1 and c=2
ORDER BY b
LIMIT 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 r
ange a_b,a_c a_b 5 NULL 19 Using index condition;
Using where
1 SIMPLE t1 r
ef a_b,a_c a_b 5 const 14
Using where
SELECT a,b,c FROM t1
WHERE a=1 and c=2
ORDER BY b
...
...
@@ -2162,16 +2162,16 @@ insert into t1 values (1,7,2), (1,8,2), (1,9,2), (1,10,2), (1,11,2), (1,12,2);
#
# index a_b should be used, no need for filesort
#
select a,b,c from t1 where a=1 and c=2 order by b limit 5;
select a,b,c from t1 where a=1 and c
<
=2 order by b limit 5;
a b c
1 7 1
1 7 2
1 7 2
1 8 1
1 8 2
1 8 2
1 9 2
explain select a,b,c from t1 where a=1 and c=2 order by b limit 5;
explain select a,b,c from t1 where a=1 and c<=2 order by b limit 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a_b,a_c a_b 5 NULL 1
0
Using index condition; Using where
1 SIMPLE t1 range a_b,a_c a_b 5 NULL 1
8
Using index condition; Using where
drop table t1;
#
# Tests where Index(scan, ref or range access) satisfies the ORDERING
...
...
@@ -2200,7 +2200,7 @@ a b
1 11
explain select a,b from t1 where a=1 and c=2 order by b limit 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 r
ange a_b,a_c a_b 5 NULL 19 Using index condition;
Using where
1 SIMPLE t1 r
ef a_b,a_c a_b 5 const 14
Using where
drop table t1;
CREATE TABLE t1(
a int NOT NULL,
...
...
@@ -2417,124 +2417,6 @@ ANALYZE TABLE t2 PERSISTENT FOR ALL;
ANALYZE TABLE t3 PERSISTENT FOR ALL;
ANALYZE TABLE t4 PERSISTENT FOR ALL;
#
# SJM scan inside the sort-nest
#
EXPLAIN SELECT t1.a, t2.a, t1.b,t2.b
FROM t1, t2, t2 ot
WHERE t1.a=t2.a AND t2.c=ot.b AND t2.b < 4 AND
t1.b IN (SELECT it1.b FROM t3 it1,t4 it2
WHERE it1.a < 4 AND it1.a=it2.a)
ORDER BY t2.b DESC ,t1.b DESC
LIMIT 5;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 8
1 PRIMARY t1 ref a,b b 5 test.it1.b 1 Using where
1 PRIMARY t2 ref a a 5 test.t1.a 1 Using where
1 PRIMARY <sort-nest> ALL NULL NULL NULL NULL 3 Using filesort
1 PRIMARY ot ALL NULL NULL NULL NULL 10 Using where
2 MATERIALIZED it1 ALL a NULL NULL NULL 10 Using where
2 MATERIALIZED it2 ref a a 5 test.it1.a 2 Using index
EXPLAIN FORMAT=JSON SELECT t1.a, t2.a, t1.b,t2.b
FROM t1, t2, t2 ot
WHERE t1.a=t2.a AND t2.c=ot.b AND t2.b < 4 AND
t1.b IN (SELECT it1.b FROM t3 it1,t4 it2
WHERE it1.a < 4 AND it1.a=it2.a)
ORDER BY t2.b DESC ,t1.b DESC
LIMIT 5;
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "<subquery2>",
"access_type": "ALL",
"possible_keys": ["distinct_key"],
"rows": 8,
"filtered": 100,
"materialized": {
"unique": 1,
"query_block": {
"select_id": 2,
"table": {
"table_name": "it1",
"access_type": "ALL",
"possible_keys": ["a"],
"rows": 10,
"filtered": 80,
"attached_condition": "it1.a < 4 and it1.a is not null and it1.b is not null"
},
"table": {
"table_name": "it2",
"access_type": "ref",
"possible_keys": ["a"],
"key": "a",
"key_length": "5",
"used_key_parts": ["a"],
"ref": ["test.it1.a"],
"rows": 2,
"filtered": 100,
"using_index": true
}
}
}
},
"table": {
"table_name": "t1",
"access_type": "ref",
"possible_keys": ["a", "b"],
"key": "b",
"key_length": "5",
"used_key_parts": ["b"],
"ref": ["test.it1.b"],
"rows": 1,
"filtered": 100,
"attached_condition": "t1.a is not null"
},
"table": {
"table_name": "t2",
"access_type": "ref",
"possible_keys": ["a"],
"key": "a",
"key_length": "5",
"used_key_parts": ["a"],
"ref": ["test.t1.a"],
"rows": 1,
"filtered": 49.219,
"attached_condition": "t2.b < 4"
},
"read_sorted_file": {
"filesort": {
"sort_key": "`sort-nest`.b desc, `sort-nest`.b desc",
"table": {
"table_name": "<sort-nest>",
"access_type": "ALL",
"rows": 3,
"filtered": 100
}
}
},
"table": {
"table_name": "ot",
"access_type": "ALL",
"rows": 10,
"filtered": 100,
"attached_condition": "ot.b = `sort-nest`.c"
}
}
}
SELECT t1.a, t2.a, t1.b,t2.b
FROM t1, t2, t2 ot
WHERE t1.a=t2.a AND t2.c=ot.b AND t2.b < 4 AND
t1.b IN (SELECT it1.b FROM t3 it1,t4 it2
WHERE it1.a < 4 AND it1.a=it2.a)
ORDER BY t2.b DESC ,t1.b DESC
LIMIT 5;
a a b b
3 3 3 3
2 2 2 2
1 1 1 1
0 0 0 0
#
# SJM Lookup with sort-nest, where SJM lookup table is outside the
# sort-nest
#
...
...
mysql-test/main/sort_nest.test
View file @
f221f10a
...
...
@@ -811,7 +811,7 @@ insert into t1 values (1,7,2), (1,8,2), (1,9,2), (1,10,2), (1,11,2), (1,12,2);
--
echo
# index a_b should be used, no need for filesort
--
echo
#
let
$query
=
select
a
,
b
,
c
from
t1
where
a
=
1
and
c
=
2
order
by
b
limit
5
;
let
$query
=
select
a
,
b
,
c
from
t1
where
a
=
1
and
c
<
=
2
order
by
b
limit
5
;
eval
$query
;
eval
explain
$query
;
...
...
@@ -1041,23 +1041,6 @@ ANALYZE TABLE t3 PERSISTENT FOR ALL;
ANALYZE
TABLE
t4
PERSISTENT
FOR
ALL
;
--
enable_result_log
--
echo
#
--
echo
# SJM scan inside the sort-nest
--
echo
#
let
$query
=
SELECT
t1
.
a
,
t2
.
a
,
t1
.
b
,
t2
.
b
FROM
t1
,
t2
,
t2
ot
WHERE
t1
.
a
=
t2
.
a
AND
t2
.
c
=
ot
.
b
AND
t2
.
b
<
4
AND
t1
.
b
IN
(
SELECT
it1
.
b
FROM
t3
it1
,
t4
it2
WHERE
it1
.
a
<
4
AND
it1
.
a
=
it2
.
a
)
ORDER
BY
t2
.
b
DESC
,
t1
.
b
DESC
LIMIT
5
;
eval
EXPLAIN
$query
;
eval
EXPLAIN
FORMAT
=
JSON
$query
;
eval
$query
;
--
echo
#
--
echo
# SJM Lookup with sort-nest, where SJM lookup table is outside the
--
echo
# sort-nest
...
...
mysql-test/main/sort_nest_dbt3.result
View file @
f221f10a
...
...
@@ -269,12 +269,12 @@ AND
c_custkey between 1 and 10
ORDER BY
l_extendedprice DESC, c_acctbal DESC, o_totalprice DESC
LIMIT
20
;
LIMIT
5
;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE customer range PRIMARY,i_c_nationkey PRIMARY 4 NULL 7 Using index condition
1 SIMPLE orders ref PRIMARY,i_o_custkey i_o_custkey 5 dbt3.customer.c_custkey 15 Using where
1 SIMPLE lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3.orders.o_orderkey 4
1 SIMPLE <sort-nest> ALL NULL NULL NULL NULL
20
Using filesort
1 SIMPLE <sort-nest> ALL NULL NULL NULL NULL
5
Using filesort
1 SIMPLE nation eq_ref PRIMARY PRIMARY 4 sort-nest.c_nationkey 1 Using index
SELECT
l_extendedprice, c_acctbal, o_totalprice, o_orderDate, l_orderkey
...
...
@@ -292,26 +292,11 @@ AND
c_custkey between 1 and 10
ORDER BY
l_extendedprice DESC, c_acctbal DESC, o_totalprice DESC
LIMIT
20
;
LIMIT
5
;
l_extendedprice c_acctbal o_totalprice o_orderDate l_orderkey
53758.5 794.47 210643.96 1997-04-23 5859
49830.24 121.65 140363.7 1998-05-28 5507
49542.24 121.65 140363.7 1998-05-28 5507
48745.11 6819.74 122823.78 1993-04-05 5794
47992.64 6819.74 140838.11 1998-06-26 5763
47615.98 6819.74 182966.39 1994-07-17 5572
46705.74 9561.95 101429.61 1993-04-21 5670
44467.59 121.65 44777.63 1992-07-08 5893
44442.3 6819.74 122823.78 1993-04-05 5794
39723.6 794.47 210643.96 1997-04-23 5859
37048.32 9561.95 95312.81 1992-03-28 5953
36860.25 794.47 210643.96 1997-04-23 5859
32996.16 6819.74 140838.11 1998-06-26 5763
31416.68 6819.74 182966.39 1994-07-17 5572
31219.32 794.47 210643.96 1997-04-23 5859
31042.34 9561.95 95312.81 1992-03-28 5953
29462.13 794.47 210643.96 1997-04-23 5859
28948.59 6819.74 182966.39 1994-07-17 5572
26732.43 9561.95 101429.61 1993-04-21 5670
24590.68 9561.95 95312.81 1992-03-28 5953
drop database dbt3;
mysql-test/main/sort_nest_dbt3.test
View file @
f221f10a
...
...
@@ -160,7 +160,7 @@ let $query= SELECT
c_custkey
between
1
and
10
ORDER
BY
l_extendedprice
DESC
,
c_acctbal
DESC
,
o_totalprice
DESC
LIMIT
20
;
LIMIT
5
;
eval
explain
$query
;
...
...
mysql-test/main/sort_nest_dbt3_innodb.result
View file @
f221f10a
...
...
@@ -270,12 +270,12 @@ AND
c_custkey between 1 and 10
ORDER BY
l_extendedprice DESC, c_acctbal DESC, o_totalprice DESC
LIMIT
20
;
LIMIT
5
;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE orders range PRIMARY,i_o_custkey PRIMARY 4 NULL 125 Using where
1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3.orders.o_custkey 1
1 SIMPLE lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3.orders.o_orderkey 4
1 SIMPLE <sort-nest> ALL NULL NULL NULL NULL
20
Using filesort
1 SIMPLE <sort-nest> ALL NULL NULL NULL NULL
5
Using filesort
1 SIMPLE nation eq_ref PRIMARY PRIMARY 4 sort-nest.c_nationkey 1 Using index
SELECT
l_extendedprice, c_acctbal, o_totalprice, o_orderDate, l_orderkey
...
...
@@ -293,26 +293,11 @@ AND
c_custkey between 1 and 10
ORDER BY
l_extendedprice DESC, c_acctbal DESC, o_totalprice DESC
LIMIT
20
;
LIMIT
5
;
l_extendedprice c_acctbal o_totalprice o_orderDate l_orderkey
53758.5 794.47 210643.96 1997-04-23 5859
49830.24 121.65 140363.7 1998-05-28 5507
49542.24 121.65 140363.7 1998-05-28 5507
48745.11 6819.74 122823.78 1993-04-05 5794
47992.64 6819.74 140838.11 1998-06-26 5763
47615.98 6819.74 182966.39 1994-07-17 5572
46705.74 9561.95 101429.61 1993-04-21 5670
44467.59 121.65 44777.63 1992-07-08 5893
44442.3 6819.74 122823.78 1993-04-05 5794
39723.6 794.47 210643.96 1997-04-23 5859
37048.32 9561.95 95312.81 1992-03-28 5953
36860.25 794.47 210643.96 1997-04-23 5859
32996.16 6819.74 140838.11 1998-06-26 5763
31416.68 6819.74 182966.39 1994-07-17 5572
31219.32 794.47 210643.96 1997-04-23 5859
31042.34 9561.95 95312.81 1992-03-28 5953
29462.13 794.47 210643.96 1997-04-23 5859
28948.59 6819.74 182966.39 1994-07-17 5572
26732.43 9561.95 101429.61 1993-04-21 5670
24590.68 9561.95 95312.81 1992-03-28 5953
drop database dbt3;
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