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
3da81ab9
Commit
3da81ab9
authored
Jun 25, 2014
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-406: ANALYZE $stmt: more testcases, fix memory leak
parent
424d5de8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
0 deletions
+43
-0
mysql-test/r/analyze_stmt.result
mysql-test/r/analyze_stmt.result
+22
-0
mysql-test/t/analyze_stmt.test
mysql-test/t/analyze_stmt.test
+20
-0
sql/sql_parse.cc
sql/sql_parse.cc
+1
-0
No files found.
mysql-test/r/analyze_stmt.result
View file @
3da81ab9
...
...
@@ -147,3 +147,25 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10 100.00 100.00 Using where
1 SIMPLE t2 ref key2x key2x 5 test.t1.a 1 0 100.00 40.00 Using where
drop table t0,t1,t2;
#
# Check non-merged derived tables
#
create table t0 (a int, b int);
insert into t0 values
(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
update t0 set b=b/3;
analyze select * from (select count(*),max(a),b from t0 group by b) T;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 10 4 100.00 100.00
2 DERIVED t0 ALL NULL NULL NULL NULL 10 10 100.00 100.00 Using temporary; Using filesort
drop table t0;
#
# Check ORDER/GROUP BY
#
create table t0 (a int, b int);
insert into t0 values
(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
analyze select count(*),max(a),b from t0 where a<7 group by b;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10 100.00 70.00 Using where; Using temporary; Using filesort
drop table t0;
mysql-test/t/analyze_stmt.test
View file @
3da81ab9
...
...
@@ -107,3 +107,23 @@ analyze select * from t1,t2 where t2.key2x=t1.a and mod(t2.col1,4)=0;
drop
table
t0
,
t1
,
t2
;
--
echo
#
--
echo
# Check non-merged derived tables
--
echo
#
create
table
t0
(
a
int
,
b
int
);
insert
into
t0
values
(
0
,
0
),(
1
,
1
),(
2
,
2
),(
3
,
3
),(
4
,
4
),(
5
,
5
),(
6
,
6
),(
7
,
7
),(
8
,
8
),(
9
,
9
);
update
t0
set
b
=
b
/
3
;
analyze
select
*
from
(
select
count
(
*
),
max
(
a
),
b
from
t0
group
by
b
)
T
;
drop
table
t0
;
--
echo
#
--
echo
# Check ORDER/GROUP BY
--
echo
#
create
table
t0
(
a
int
,
b
int
);
insert
into
t0
values
(
0
,
0
),(
1
,
1
),(
2
,
2
),(
3
,
3
),(
4
,
4
),(
5
,
5
),(
6
,
6
),(
7
,
7
),(
8
,
8
),(
9
,
9
);
analyze
select
count
(
*
),
max
(
a
),
b
from
t0
where
a
<
7
group
by
b
;
drop
table
t0
;
sql/sql_parse.cc
View file @
3da81ab9
...
...
@@ -5283,6 +5283,7 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
result
=
save_result
;
if
(
!
result
&&
!
(
result
=
new
select_send
()))
return
1
;
delete
thd
->
protocol
;
thd
->
protocol
=
save_protocol
;
thd
->
lex
->
explain
->
send_explain
(
thd
);
...
...
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