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
c46eadb2
Commit
c46eadb2
authored
Nov 29, 2014
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EXPLAIN FORMAT=JSON: support EXPLAIN FORMAT=JSON INSERT ...
parent
e235bb86
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
8 deletions
+60
-8
mysql-test/r/explain_json.result
mysql-test/r/explain_json.result
+36
-1
mysql-test/t/explain_json.test
mysql-test/t/explain_json.test
+8
-1
sql/sql_explain.cc
sql/sql_explain.cc
+15
-4
sql/sql_explain.h
sql/sql_explain.h
+1
-2
No files found.
mysql-test/r/explain_json.result
View file @
c46eadb2
...
...
@@ -343,7 +343,7 @@ EXPLAIN
}
drop table t1;
#
# Single-table UPDATE/DELETE
# Single-table UPDATE/DELETE
, INSERT
#
explain format=json delete from t0;
EXPLAIN
...
...
@@ -393,6 +393,41 @@ EXPLAIN
}
}
}
explain format=json insert into t0 values (1);
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "t0"
}
}
}
create table t1 like t0;
explain format=json insert into t1 values ((select max(a) from t0));
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "t1"
},
"subqueries": [
{
"query_block": {
"select_id": 2,
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"filtered": 100
}
}
}
]
}
}
drop table t1;
#
# A derived table
#
...
...
mysql-test/t/explain_json.test
View file @
c46eadb2
...
...
@@ -71,7 +71,7 @@ select * from t1 tbl1, t1 tbl2 where tbl1.a=tbl2.a and tbl1.b < 3 and tbl2.b < 5
drop
table
t1
;
--
echo
#
--
echo
# Single-table UPDATE/DELETE
--
echo
# Single-table UPDATE/DELETE
, INSERT
--
echo
#
explain
format
=
json
delete
from
t0
;
explain
format
=
json
delete
from
t0
where
1
>
2
;
...
...
@@ -80,6 +80,13 @@ explain format=json delete from t0 where a < 3;
explain
format
=
json
update
t0
set
a
=
3
where
a
in
(
2
,
3
,
4
);
explain
format
=
json
insert
into
t0
values
(
1
);
create
table
t1
like
t0
;
explain
format
=
json
insert
into
t1
values
((
select
max
(
a
)
from
t0
));
drop
table
t1
;
--
echo
#
--
echo
# A derived table
--
echo
#
...
...
sql/sql_explain.cc
View file @
c46eadb2
...
...
@@ -194,10 +194,7 @@ void Explain_query::print_explain_json(select_result_sink *output, bool is_analy
if
(
upd_del_plan
)
upd_del_plan
->
print_explain_json
(
this
,
&
writer
,
is_analyze
);
else
if
(
insert_plan
)
{
//insert_plan->print_explain(this, output, explain_flags, is_analyze);
DBUG_ASSERT
(
0
);
}
insert_plan
->
print_explain_json
(
this
,
&
writer
,
is_analyze
);
else
{
/* Start printing from node with id=1 */
...
...
@@ -1808,6 +1805,20 @@ int Explain_insert::print_explain(Explain_query *query,
return
print_explain_for_children
(
query
,
output
,
explain_flags
,
is_analyze
);
}
void
Explain_insert
::
print_explain_json
(
Explain_query
*
query
,
Json_writer
*
writer
,
bool
is_analyze
)
{
Json_writer_nesting_guard
guard
(
writer
);
writer
->
add_member
(
"query_block"
).
start_object
();
writer
->
add_member
(
"select_id"
).
add_ll
(
1
);
writer
->
add_member
(
"table"
).
start_object
();
writer
->
add_member
(
"table_name"
).
add_str
(
table_name
.
c_ptr
());
writer
->
end_object
();
// table
print_explain_json_for_children
(
query
,
writer
,
is_analyze
);
writer
->
end_object
();
// query_block
}
void
delete_explain_query
(
LEX
*
lex
)
{
...
...
sql/sql_explain.h
View file @
c46eadb2
...
...
@@ -704,8 +704,7 @@ class Explain_insert : public Explain_node
int
print_explain
(
Explain_query
*
query
,
select_result_sink
*
output
,
uint8
explain_flags
,
bool
is_analyze
);
void
print_explain_json
(
Explain_query
*
query
,
Json_writer
*
writer
,
bool
is_analyze
)
{
/* EXPLAIN_JSON_NOT_IMPL */
}
bool
is_analyze
);
};
...
...
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