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
9b0225f2
Commit
9b0225f2
authored
Apr 15, 2020
by
Varun Gupta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more test added
parent
74d080d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
95 additions
and
0 deletions
+95
-0
mysql-test/main/sort_nest.result
mysql-test/main/sort_nest.result
+58
-0
mysql-test/main/sort_nest.test
mysql-test/main/sort_nest.test
+37
-0
No files found.
mysql-test/main/sort_nest.result
View file @
9b0225f2
...
...
@@ -2047,6 +2047,64 @@ a a b b
1 1 1 1
0 0 0 0
set @@optimizer_switch= @save_optimizer_switch;
#
# Semi join materialization lookup
#
EXPLAIN SELECT t1.a, t2.a, t1.b,t2.b
FROM t1, t2
WHERE t1.a=t2.a AND
t1.b IN (SELECT t4.a FROM t3,t4 WHERE t4.a <= 5)
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 t2 ALL a NULL NULL NULL 10 Using where
1 PRIMARY t1 ref a a 5 test.t2.a 1
1 PRIMARY <sort-nest> ALL NULL NULL NULL NULL 1 Using filesort
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
2 MATERIALIZED t3 index NULL b 5 NULL 10 Using index
2 MATERIALIZED t4 index a a 5 NULL 10 Using where; Using index; Using join buffer (flat, BNL join)
SELECT t1.a, t2.a, t1.b,t2.b
FROM t1, t2
WHERE t1.a=t2.a AND
t1.b IN (SELECT t4.a FROM t3,t4 WHERE t4.a <= 5)
ORDER BY t2.b DESC, t1.b DESC
LIMIT 5;
a a b b
4 4 4 4
3 3 3 3
2 2 2 2
1 1 1 1
0 0 0 0
#
# Loosescan strategy
#
set @save_optimizer_switch= @@optimizer_switch;
set optimizer_switch='materialization=off,firstmatch=off';
ALTER TABLE t1 ADD KEY b(b);
EXPLAIN SELECT t1.a, t2.a, t1.b,t2.b
FROM t1, t2
WHERE t1.a=t2.a AND
t1.b IN (SELECT t4.a FROM t4)
ORDER BY t2.a DESC, t1.b DESC
LIMIT 5;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t4 index a a 5 NULL 10 Using where; Using index; LooseScan
1 PRIMARY t1 ref a,b b 5 test.t4.a 1
1 PRIMARY <sort-nest> ALL NULL NULL NULL NULL 5 Using filesort
1 PRIMARY t2 ref a a 5 sort-nest.a 1
SELECT t1.a, t2.a, t1.b,t2.b
FROM t1, t2
WHERE t1.a=t2.a AND
t1.b IN (SELECT t4.a FROM t4)
ORDER BY t2.a DESC, t1.b DESC
LIMIT 5;
a a b b
4 4 4 4
3 3 3 3
2 2 2 2
1 1 1 1
0 0 0 0
set @@optimizer_switch= @save_optimizer_switch;
drop table t0,t1,t2,t3,t4;
# NON-MERGED SEMI JOINS
...
...
mysql-test/main/sort_nest.test
View file @
9b0225f2
...
...
@@ -968,6 +968,43 @@ eval EXPLAIN $query;
eval
$query
;
set
@@
optimizer_switch
=
@
save_optimizer_switch
;
--
echo
#
--
echo
# Semi join materialization lookup
--
echo
#
let
$query
=
SELECT
t1
.
a
,
t2
.
a
,
t1
.
b
,
t2
.
b
FROM
t1
,
t2
WHERE
t1
.
a
=
t2
.
a
AND
t1
.
b
IN
(
SELECT
t4
.
a
FROM
t3
,
t4
WHERE
t4
.
a
<=
5
)
ORDER
BY
t2
.
b
DESC
,
t1
.
b
DESC
LIMIT
5
;
eval
EXPLAIN
$query
;
eval
$query
;
--
echo
#
--
echo
# Loosescan strategy
--
echo
#
set
@
save_optimizer_switch
=
@@
optimizer_switch
;
set
optimizer_switch
=
'materialization=off,firstmatch=off'
;
let
$query
=
SELECT
t1
.
a
,
t2
.
a
,
t1
.
b
,
t2
.
b
FROM
t1
,
t2
WHERE
t1
.
a
=
t2
.
a
AND
t1
.
b
IN
(
SELECT
t4
.
a
FROM
t4
)
ORDER
BY
t2
.
a
DESC
,
t1
.
b
DESC
LIMIT
5
;
ALTER
TABLE
t1
ADD
KEY
b
(
b
);
eval
EXPLAIN
$query
;
eval
$query
;
set
@@
optimizer_switch
=
@
save_optimizer_switch
;
drop
table
t0
,
t1
,
t2
,
t3
,
t4
;
--
echo
...
...
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