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
302bf7c4
Commit
302bf7c4
authored
Jul 02, 2015
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tabular ANALYZE must get its data from execution tracker
parent
28a8ba08
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
101 additions
and
3 deletions
+101
-3
mysql-test/r/analyze_stmt_orderby.result
mysql-test/r/analyze_stmt_orderby.result
+45
-0
mysql-test/t/analyze_stmt_orderby.test
mysql-test/t/analyze_stmt_orderby.test
+26
-1
sql/sql_explain.cc
sql/sql_explain.cc
+30
-2
No files found.
mysql-test/r/analyze_stmt_orderby.result
View file @
302bf7c4
...
...
@@ -531,4 +531,49 @@ EXPLAIN
}
drop table t5,t6,t7;
drop table t3;
#
# Tabular ANALYZE must get its data from execution tracker (and not from
# the query plan)
#
CREATE TABLE t2(
col1 int,
col2 int,
UNIQUE INDEX idx (col1, col2)) engine=myisam;
INSERT INTO t2(col1, col2) VALUES
(1,20),(2,19),(3,18),(4,17),(5,16),(6,15),(7,14),(8,13),(9,12),(10,11),
(11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1);
flush status;
explain
select col1 f1, col2 f2, col1 f3 from t2 group by f1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range NULL idx 5 NULL 7 Using index for group-by
analyze
select col1 f1, col2 f2, col1 f3 from t2 group by f1;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t2 range NULL idx 5 NULL 7 20.00 100.00 100.00 Using index for group-by
analyze format=json
select col1 f1, col2 f2, col1 f3 from t2 group by f1;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "range",
"key": "idx",
"key_length": "5",
"used_key_parts": ["col1"],
"r_loops": 1,
"rows": 7,
"r_rows": 20,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
"using_index_for_group_by": true
}
}
}
drop table t2;
drop table t0,t1;
mysql-test/t/analyze_stmt_orderby.test
View file @
302bf7c4
...
...
@@ -147,6 +147,31 @@ select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= 5
group by t5.a order by sum limit 1;
drop table t5,t6,t7;
drop table t3;
--echo #
--echo # Tabular ANALYZE must get its data from execution tracker (and not from
--echo # the query plan)
--echo #
CREATE TABLE t2(
col1 int,
col2 int,
UNIQUE INDEX idx (col1, col2)) engine=myisam;
INSERT INTO t2(col1, col2) VALUES
(1,20),(2,19),(3,18),(4,17),(5,16),(6,15),(7,14),(8,13),(9,12),(10,11),
(11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1);
flush status;
explain
select col1 f1, col2 f2, col1 f3 from t2 group by f1;
analyze
select col1 f1, col2 f2, col1 f3 from t2 group by f1;
--replace_regex /"
r_total_time_ms
": [0-9]*[.]?[0-9]*/"
r_total_time_ms
": "
REPLACED
"/ /"
r_buffer_size
": "
[
^
"]+"
/
"r_buffer_size"
:
"REPLACED"
/
analyze
format
=
json
select
col1
f1
,
col2
f2
,
col1
f3
from
t2
group
by
f1
;
drop
table
t2
;
drop
table
t0
,
t1
;
sql/sql_explain.cc
View file @
302bf7c4
...
...
@@ -726,8 +726,36 @@ int Explain_select::print_explain(Explain_query *query,
}
else
{
bool
using_tmp
=
using_temporary
;
bool
using_fs
=
using_filesort
;
bool
using_tmp
;
bool
using_fs
;
if
(
is_analyze
)
{
/*
Get the data about "Using temporary; Using filesort" from execution
tracking system.
*/
using_tmp
=
false
;
using_fs
=
false
;
Sort_and_group_tracker
::
Iterator
iter
(
&
ops_tracker
);
enum_qep_action
action
;
Filesort_tracker
*
dummy
;
while
((
action
=
iter
.
get_next
(
&
dummy
))
!=
EXPL_ACTION_EOF
)
{
if
(
action
==
EXPL_ACTION_FILESORT
)
using_fs
=
true
;
else
if
(
action
==
EXPL_ACTION_TEMPTABLE
)
using_tmp
=
true
;
}
}
else
{
/* Use imprecise "estimates" we got with the query plan */
using_tmp
=
using_temporary
;
using_fs
=
using_filesort
;
}
for
(
uint
i
=
0
;
i
<
n_join_tabs
;
i
++
)
{
join_tabs
[
i
]
->
print_explain
(
output
,
explain_flags
,
is_analyze
,
select_id
,
...
...
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