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
ebe2bd74
Commit
ebe2bd74
authored
Jun 20, 2015
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-7836: ANALYZE FORMAT=JSON should provide info about GROUP BY
ANALYZE should also record remove_duplicates() operation.
parent
f33173d1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
97 additions
and
13 deletions
+97
-13
mysql-test/r/analyze_stmt_orderby.result
mysql-test/r/analyze_stmt_orderby.result
+54
-7
mysql-test/t/analyze_stmt_orderby.test
mysql-test/t/analyze_stmt_orderby.test
+17
-6
sql/sql_analyze_stmt.cc
sql/sql_analyze_stmt.cc
+19
-0
sql/sql_analyze_stmt.h
sql/sql_analyze_stmt.h
+6
-0
sql/sql_select.cc
sql/sql_select.cc
+1
-0
No files found.
mysql-test/r/analyze_stmt_orderby.result
View file @
ebe2bd74
...
...
@@ -363,21 +363,68 @@ ANALYZE
}
}
drop table t2;
drop table t0, t1;
#
# MDEV-8282: crash in filesort() with simple ordered delete
#
create table t
1
(a int) engine=innodb;
delete from t
1
order by a;
create table t
3
(a int) engine=innodb;
delete from t
3
order by a;
# EXPLAIN thinks it will use delete_all_rows():
explain
delete from t
1
order by a;
delete from t
3
order by a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL 1 Deleting all rows
# ANALYZE shows that delete_all_rows() didn't work and we deleted rows
# one-by-one:
analyze
delete from t
1
order by a;
delete from t
3
order by a;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1 0.00 100.00 100.00 Using filesort
drop table t1;
1 SIMPLE t3 ALL NULL NULL NULL NULL 1 0.00 100.00 100.00 Using filesort
drop table t3;
#
#
#
create table t3 (a int, b int);
insert into t3 select a, 123 from t0;
analyze format=json
select distinct max(t3.b) Q from t0, t3 where t0.a=t3.a group by t0.a order by null;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"duplicate_removal": {
"temporary_table": {
"table": {
"table_name": "t0",
"access_type": "ALL",
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100
},
"block-nl-join": {
"table": {
"table_name": "t3",
"access_type": "ALL",
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100
},
"buffer_type": "flat",
"buffer_size": "128Kb",
"join_type": "BNL",
"attached_condition": "(t3.a = t0.a)",
"r_filtered": 10
}
}
}
}
}
drop table t3;
drop table t0,t1;
mysql-test/t/analyze_stmt_orderby.test
View file @
ebe2bd74
...
...
@@ -91,22 +91,33 @@ analyze format=json
select MAX(b) from t2 where mod(a,2)=0 group by c;
drop table t2;
drop table t0, t1;
--echo #
--echo # MDEV-8282: crash in filesort() with simple ordered delete
--echo #
create table t
1
(a int) engine=innodb;
delete from t
1
order by a;
create table t
3
(a int) engine=innodb;
delete from t
3
order by a;
--echo # EXPLAIN thinks it will use delete_all_rows():
explain
delete from t
1
order by a;
delete from t
3
order by a;
--echo # ANALYZE shows that delete_all_rows() didn't work and we deleted rows
--echo # one-by-one:
analyze
delete from t
1
order by a;
delete from t
3
order by a;
drop table t
1
;
drop table t
3
;
--echo #
--echo #
--echo #
create table t3 (a int, b int);
insert into t3 select a, 123 from t0;
--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
distinct
max
(
t3
.
b
)
Q
from
t0
,
t3
where
t0
.
a
=
t3
.
a
group
by
t0
.
a
order
by
null
;
drop
table
t3
;
drop
table
t0
,
t1
;
sql/sql_analyze_stmt.cc
View file @
ebe2bd74
...
...
@@ -113,3 +113,22 @@ void Sort_and_group_tracker::report_tmp_table(TABLE *tbl)
cur_action
++
;
}
void
Sort_and_group_tracker
::
report_duplicate_removal
()
{
DBUG_ASSERT
(
cur_action
<
MAX_QEP_ACTIONS
);
if
(
total_actions
)
{
/* This is not the first execution. Check if the steps match. */
if
(
qep_actions
[
cur_action
]
!=
EXPL_ACTION_REMOVE_DUPS
)
varied_executions
=
true
;
}
if
(
!
varied_executions
)
{
qep_actions
[
cur_action
]
=
EXPL_ACTION_REMOVE_DUPS
;
}
cur_action
++
;
}
sql/sql_analyze_stmt.h
View file @
ebe2bd74
...
...
@@ -398,6 +398,12 @@ public:
*/
Filesort_tracker
*
report_sorting
(
THD
*
thd
);
/*
Report that remove_duplicates() is invoked [on a temp. table].
We don't collect any statistics on this operation, yet.
*/
void
report_duplicate_removal
();
friend
class
Iterator
;
/*************** Statistics retrieval interface ***************/
bool
had_varied_executions
()
{
return
varied_executions
;
}
...
...
sql/sql_select.cc
View file @
ebe2bd74
...
...
@@ -21179,6 +21179,7 @@ remove_duplicates(JOIN *join, TABLE *table, List<Item> &fields, Item *having)
THD
*
thd
=
join
->
thd
;
DBUG_ENTER
(
"remove_duplicates"
);
join
->
explain
->
ops_tracker
.
report_duplicate_removal
();
table
->
reginfo
.
lock_type
=
TL_WRITE
;
...
...
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