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
917b2239
Commit
917b2239
authored
Jun 03, 2014
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-406: ANALYZE $stmt
- Testcase for ANALYZE UNION - Provide r_rows for union result.
parent
5621aa32
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
3 deletions
+19
-3
mysql-test/t/analyze_stmt.test
mysql-test/t/analyze_stmt.test
+7
-0
sql/sql_explain.cc
sql/sql_explain.cc
+7
-3
sql/sql_explain.h
sql/sql_explain.h
+5
-0
No files found.
mysql-test/t/analyze_stmt.test
View file @
917b2239
...
...
@@ -28,4 +28,11 @@ analyze update t1 set b=100+b where a in (6,7,8);
select
*
from
t1
;
drop
table
t1
;
--
echo
# Check that UNION works
create
table
t1
(
a
int
,
b
int
);
insert
into
t1
select
a
,
a
from
t0
;
analyze
(
select
*
from
t1
A
where
a
<
5
)
union
(
select
*
from
t1
B
where
a
in
(
5
,
6
));
analyze
(
select
*
from
t1
A
where
a
<
5
)
union
(
select
*
from
t1
B
where
a
in
(
1
,
2
));
drop
table
t1
;
drop
table
t0
;
sql/sql_explain.cc
View file @
917b2239
...
...
@@ -291,7 +291,11 @@ int Explain_union::print_explain(Explain_query *query,
/* `r_rows` */
if
(
is_analyze
)
item_list
.
push_back
(
item_null
);
{
ha_rows
avg_rows
=
fake_select_lex_tracker
.
get_avg_rows
();
item_list
.
push_back
(
new
Item_int
((
longlong
)
(
ulonglong
)
avg_rows
,
MY_INT64_NUM_DECIMAL_DIGITS
));
}
/* `filtered` */
if
(
explain_flags
&
DESCRIBE_EXTENDED
||
is_analyze
)
...
...
@@ -542,8 +546,8 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
/* `r_rows` */
if
(
is_analyze
)
{
ha_rows
avg_rows
=
tracker
.
r_scans
?
round
((
double
)
tracker
.
r_rows
/
tracker
.
r_scans
)
:
0
;
item_list
.
push_back
(
new
Item_int
((
longlong
)
(
ulonglong
)
avg_rows
,
ha_rows
avg_rows
=
tracker
.
get_avg_rows
()
;
item_list
.
push_back
(
new
Item_int
((
longlong
)
(
ulonglong
)
avg_rows
,
MY_INT64_NUM_DECIMAL_DIGITS
));
}
...
...
sql/sql_explain.h
View file @
917b2239
...
...
@@ -27,6 +27,11 @@ class Table_access_tracker
ha_rows
r_rows
;
/* How many rows we've got after that */
ha_rows
r_rows_after_table_cond
;
/* Rows after applying the table condition */
ha_rows
r_rows_after_where
;
/* Rows after applying attached part of WHERE */
ha_rows
get_avg_rows
()
{
return
r_scans
?
round
((
double
)
r_rows
/
r_scans
)
:
0
;
}
};
...
...
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