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
5422098b
Commit
5422098b
authored
Jun 27, 2013
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More of code cleanup
parent
c0f7efb1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
32 deletions
+33
-32
sql/opt_qpf.h
sql/opt_qpf.h
+31
-23
sql/sql_select.cc
sql/sql_select.cc
+2
-9
No files found.
sql/opt_qpf.h
View file @
5422098b
...
...
@@ -50,18 +50,19 @@ class QPF_table_access;
Query Plan Footprint of a SELECT.
A select can be:
- a
degenerate case. In this case, message!=NULL, and it contains a
description of what kind of degenerate case it is (e.g. "Impossible
WHERE").
- a join. Here join_tabs has an array of JOIN_TAB query plan footprints
.
1. A
degenerate case. In this case, message!=NULL, and it contains a
description of what kind of degenerate case it is (e.g. "Impossible
WHERE").
2. a non-degenrate join. In this case, join_tabs describes the join
.
In the non-degenerate case, a SELECT may have a GROUP BY/ORDER BY operation.
In both cases, a select may have children selects (see QPF_node)
In both cases, the select may have children nodes. class QPF_node provides
a way get node's children.
*/
class
QPF_select
:
public
QPF_node
{
/*Construction interface */
public:
enum
qpf_node_type
get_type
()
{
return
QPF_SELECT
;
}
...
...
@@ -107,10 +108,6 @@ public:
bool
using_temporary
;
bool
using_filesort
;
void
print_tabular
(
select_result_sink
*
output
,
uint8
explain_flags
//,
//bool *printed_anything
);
int
print_explain
(
QPF_query
*
query
,
select_result_sink
*
output
,
uint8
explain_flags
);
};
...
...
@@ -223,9 +220,13 @@ public:
private:
Dynamic_array
<
QPF_union
*>
unions
;
Dynamic_array
<
QPF_select
*>
selects
;
//QPF_union *unions[MAX_TABLES];
//QPF_select *selects[MAX_TABLES];
/*
Debugging aid: count how many times add_node() was called. Ideally, it
should be one, we currently allow O(1) query plan saves for each
select or union. The goal is not to have O(#rows_in_some_table), which
is unacceptable.
*/
longlong
operations
;
};
...
...
@@ -303,9 +304,6 @@ public:
uint
key_no
;
uint
key_length
;
Dynamic_array
<
enum
Extra_tag
>
extra_tags
;
//temporary:
bool
key_set
;
/* not set means 'NULL' should be printed */
StringBuffer
<
64
>
key
;
...
...
@@ -315,15 +313,18 @@ public:
bool
ref_set
;
/* not set means 'NULL' should be printed */
StringBuffer
<
64
>
ref
;
bool
rows_set
;
bool
rows_set
;
/* not set means 'NULL' should be printed */
ha_rows
rows
;
bool
filtered_set
;
bool
filtered_set
;
/* not set means 'NULL' should be printed */
double
filtered
;
/* Various stuff for 'Extra' column*/
uint
join_cache_level
;
/*
Contents of the 'Extra' column. Some are converted into strings, some have
parameters, values for which are stored below.
*/
Dynamic_array
<
enum
Extra_tag
>
extra_tags
;
// Valid if ET_USING tag is present
StringBuffer
<
64
>
quick_info
;
...
...
@@ -351,7 +352,10 @@ private:
/*
Query Plan Footprint for an UPDATE statement
Query Plan Footprint for single-table UPDATE.
This is similar to QPF_table_access, except that it is more restrictive.
Also, it can have UPDATE operation options, but currently there aren't any.
*/
class
QPF_update
:
public
QPF_node
...
...
@@ -382,12 +386,16 @@ public:
/*
Query Plan Footprint for a
DELETE statement
Query Plan Footprint for a
single-table DELETE.
*/
class
QPF_delete
:
public
QPF_update
{
public:
/*
TRUE means we're going to call handler->delete_all_rows() and not read any
rows.
*/
bool
deleting_all_rows
;
virtual
enum
qpf_node_type
get_type
()
{
return
QPF_DELETE
;
}
...
...
sql/sql_select.cc
View file @
5422098b
...
...
@@ -22448,9 +22448,9 @@ void append_possible_keys(String *str, TABLE *table, key_map possible_keys)
/*
Save Query Plan Footprint
push_extra
P
@note
Currently, this function may be called multiple times
*/
int
JOIN
::
save_qpf
(
QPF_query
*
output
,
bool
need_tmp_table
,
bool
need_order
,
...
...
@@ -22471,11 +22471,6 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
DBUG_ASSERT
(
have_query_plan
==
QEP_AVAILABLE
);
/* Don't log this into the slow query log */
/*
NOTE: the number/types of items pushed into item_list must be in sync with
EXPLAIN column types as they're "defined" in THD::send_explain_fields()
*/
if
(
message
)
{
QPF_select
*
qp_sel
;
...
...
@@ -22998,8 +22993,6 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
output
->
add_node
(
qp_sel
);
}
//TODO: can a UNION have subquery children that are not union members? yes,
//perhaps...
for
(
SELECT_LEX_UNIT
*
unit
=
join
->
select_lex
->
first_inner_unit
();
unit
;
unit
=
unit
->
next_unit
())
...
...
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