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
ab44e892
Commit
ab44e892
authored
Feb 28, 2016
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-9652: EXPLAIN FORMAT=JSON should show outer_ref_cond
Show outer_ref_condition in EXPLAIN FORMAT=JSON output.
parent
0dbfc0fd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
1 deletion
+59
-1
mysql-test/r/explain_json.result
mysql-test/r/explain_json.result
+40
-0
mysql-test/t/explain_json.test
mysql-test/t/explain_json.test
+10
-0
sql/sql_explain.cc
sql/sql_explain.cc
+6
-0
sql/sql_explain.h
sql/sql_explain.h
+2
-1
sql/sql_select.cc
sql/sql_select.cc
+1
-0
No files found.
mysql-test/r/explain_json.result
View file @
ab44e892
...
...
@@ -1543,3 +1543,43 @@ ANALYZE
set optimizer_switch=@tmp_optimizer_switch;
set join_cache_level=@tmp_join_cache_level;
drop table t1,t2,t3,t4;
#
# MDEV-9652: EXPLAIN FORMAT=JSON should show outer_ref_cond
#
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (a int, b int);
insert into t1 select a,a from t0;
explain format=json
select a, (select max(a) from t1 where t0.a<5 and t1.b<t0.a) from t0;
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"filtered": 100
},
"subqueries": [
{
"expression_cache": {
"state": "uninitialized",
"query_block": {
"select_id": 2,
"outer_ref_condition": "(t0.a < 5)",
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"filtered": 100,
"attached_condition": "((t0.a < 5) and (t1.b < t0.a))"
}
}
}
}
]
}
}
drop table t0,t1;
mysql-test/t/explain_json.test
View file @
ab44e892
...
...
@@ -394,5 +394,15 @@ set join_cache_level=@tmp_join_cache_level;
drop
table
t1
,
t2
,
t3
,
t4
;
--
echo
#
--
echo
# MDEV-9652: EXPLAIN FORMAT=JSON should show outer_ref_cond
--
echo
#
create
table
t0
(
a
int
);
insert
into
t0
values
(
0
),(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
),(
9
);
create
table
t1
(
a
int
,
b
int
);
insert
into
t1
select
a
,
a
from
t0
;
explain
format
=
json
select
a
,
(
select
max
(
a
)
from
t1
where
t0
.
a
<
5
and
t1
.
b
<
t0
.
a
)
from
t0
;
drop
table
t0
,
t1
;
sql/sql_explain.cc
View file @
ab44e892
...
...
@@ -862,6 +862,12 @@ void Explain_select::print_explain_json(Explain_query *query,
writer
->
add_member
(
"const_condition"
);
write_item
(
writer
,
exec_const_cond
);
}
if
(
outer_ref_cond
)
{
writer
->
add_member
(
"outer_ref_condition"
);
write_item
(
writer
,
outer_ref_cond
);
}
/* we do not print HAVING which always evaluates to TRUE */
if
(
having
||
(
having_value
==
Item
::
COND_FALSE
))
{
...
...
sql/sql_explain.h
View file @
ab44e892
...
...
@@ -232,9 +232,10 @@ class Explain_select : public Explain_basic_join
/* Expensive constant condition */
Item
*
exec_const_cond
;
Item
*
outer_ref_cond
;
/* HAVING condition */
COND
*
having
;
Item
*
having
;
Item
::
cond_result
having_value
;
/* Global join attributes. In tabular form, they are printed on the first row */
...
...
sql/sql_select.cc
View file @
ab44e892
...
...
@@ -24252,6 +24252,7 @@ int JOIN::save_explain_data_intern(Explain_query *output, bool need_tmp_table,
xpl_sel
->
using_filesort
=
true
;
xpl_sel
->
exec_const_cond
=
exec_const_cond
;
xpl_sel
->
outer_ref_cond
=
outer_ref_cond
;
if
(
tmp_having
)
xpl_sel
->
having
=
tmp_having
;
else
...
...
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