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
9cac7649
Commit
9cac7649
authored
Dec 06, 2014
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EXPLAIN FORMAT=JSON: Support range+MRR plans (when MRR is used but BKA is not)
parent
8fb2c80f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
0 deletions
+53
-0
mysql-test/r/explain_json.result
mysql-test/r/explain_json.result
+27
-0
mysql-test/t/explain_json.test
mysql-test/t/explain_json.test
+12
-0
sql/sql_explain.cc
sql/sql_explain.cc
+3
-0
sql/sql_explain.h
sql/sql_explain.h
+11
-0
No files found.
mysql-test/r/explain_json.result
View file @
9cac7649
...
...
@@ -665,4 +665,31 @@ EXPLAIN
}
set optimizer_switch=@tmp;
drop table t1,t2;
#
# MRR for range access (no BKA, just MRR)
#
create table t1 (a int, b int, key(a));
insert into t1 select tbl1.a+10*tbl2.a, 12345 from t0 tbl1, t0 tbl2;
set @tmp= @@optimizer_switch;
set optimizer_switch='mrr=on,mrr_sort_keys=on';
explain format=json select * from t1 where a < 3;
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "t1",
"access_type": "range",
"possible_keys": ["a"],
"key": "a",
"key_length": "5",
"used_key_parts": ["a"],
"rows": 1,
"filtered": 100,
"index_condition": "(t1.a < 3)",
"mrr_type": "Rowid-ordered scan"
}
}
}
drop table t1;
drop table t0;
mysql-test/t/explain_json.test
View file @
9cac7649
...
...
@@ -134,5 +134,17 @@ select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b);
set
optimizer_switch
=@
tmp
;
drop
table
t1
,
t2
;
--
echo
#
--
echo
# MRR for range access (no BKA, just MRR)
--
echo
#
create
table
t1
(
a
int
,
b
int
,
key
(
a
));
insert
into
t1
select
tbl1
.
a
+
10
*
tbl2
.
a
,
12345
from
t0
tbl1
,
t0
tbl2
;
set
@
tmp
=
@@
optimizer_switch
;
set
optimizer_switch
=
'mrr=on,mrr_sort_keys=on'
;
explain
format
=
json
select
*
from
t1
where
a
<
3
;
drop
table
t1
;
drop
table
t0
;
sql/sql_explain.cc
View file @
9cac7649
...
...
@@ -1144,6 +1144,9 @@ void Explain_table_access::tag_to_json(Json_writer *writer, enum explain_extra_t
case
ET_LOOSESCAN
:
writer
->
add_member
(
"loose_scan"
).
add_bool
(
true
);
break
;
case
ET_USING_MRR
:
writer
->
add_member
(
"mrr_type"
).
add_str
(
mrr_type
.
c_ptr
());
break
;
default:
DBUG_ASSERT
(
0
);
}
...
...
sql/sql_explain.h
View file @
9cac7649
...
...
@@ -450,13 +450,24 @@ enum explain_extra_tag
};
/*
Explain data structure describing join buffering use.
*/
class
EXPLAIN_BKA_TYPE
{
public:
EXPLAIN_BKA_TYPE
()
:
join_alg
(
NULL
)
{}
bool
incremental
;
/*
NULL if no join buferring used.
Other values: BNL, BNLH, BKA, BKAH.
*/
const
char
*
join_alg
;
/* Information about MRR usage. */
StringBuffer
<
64
>
mrr_type
;
bool
is_using_jbuf
()
{
return
(
join_alg
!=
NULL
);
}
...
...
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