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
1ec99931
Commit
1ec99931
authored
Jun 18, 2013
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SHOW] EXPLAIN UPDATE/DELETE, code re-architecting
- Fix more problems to pass the testsuite (not finished yet)
parent
d97ca5f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
15 deletions
+19
-15
sql/sql_select.cc
sql/sql_select.cc
+19
-15
No files found.
sql/sql_select.cc
View file @
1ec99931
...
@@ -22929,7 +22929,7 @@ void append_possible_keys(String *str, TABLE *table, key_map possible_keys)
...
@@ -22929,7 +22929,7 @@ void append_possible_keys(String *str, TABLE *table, key_map possible_keys)
int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
bool distinct, const char *message)
bool distinct, const char *message)
{
{
QPF_select
*
qp_sel
;
QPF_select *qp_sel
= NULL
;
const bool on_the_fly= true;
const bool on_the_fly= true;
JOIN *join= this; /* Legacy: this code used to be a non-member function */
JOIN *join= this; /* Legacy: this code used to be a non-member function */
...
@@ -22944,7 +22944,6 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
...
@@ -22944,7 +22944,6 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
DBUG_ASSERT(have_query_plan == QEP_AVAILABLE);
DBUG_ASSERT(have_query_plan == QEP_AVAILABLE);
/* Don't log this into the slow query log */
/* Don't log this into the slow query log */
qp_sel
=
new
QPF_select
;
/*
/*
NOTE: the number/types of items pushed into item_list must be in sync with
NOTE: the number/types of items pushed into item_list must be in sync with
...
@@ -22952,6 +22951,7 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
...
@@ -22952,6 +22951,7 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
*/
*/
if (message)
if (message)
{
{
qp_sel= new QPF_select;
join->select_lex->set_explain_type(on_the_fly);
join->select_lex->set_explain_type(on_the_fly);
qp_sel->select_id= join->select_lex->select_number;
qp_sel->select_id= join->select_lex->select_number;
...
@@ -22981,6 +22981,7 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
...
@@ -22981,6 +22981,7 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
else if (!join->select_lex->master_unit()->derived ||
else if (!join->select_lex->master_unit()->derived ||
join->select_lex->master_unit()->derived->is_materialized_derived())
join->select_lex->master_unit()->derived->is_materialized_derived())
{
{
qp_sel= new QPF_select;
table_map used_tables=0;
table_map used_tables=0;
if (on_the_fly)
if (on_the_fly)
...
@@ -23059,7 +23060,7 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
...
@@ -23059,7 +23060,7 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
int len= my_snprintf(table_name_buffer, sizeof(table_name_buffer)-1,
int len= my_snprintf(table_name_buffer, sizeof(table_name_buffer)-1,
"<derived%u>",
"<derived%u>",
table->derived_select_number);
table->derived_select_number);
qpt
->
table_name
.
set
(
table_name_buffer
,
len
,
cs
);
qpt->table_name.
append
(table_name_buffer, len, cs);
}
}
else if (tab->bush_children)
else if (tab->bush_children)
{
{
...
@@ -23074,7 +23075,7 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
...
@@ -23074,7 +23075,7 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
else
else
{
{
TABLE_LIST *real_table= table->pos_in_table_list;
TABLE_LIST *real_table= table->pos_in_table_list;
qpt
->
table_name
.
set
(
real_table
->
alias
,
strlen
(
real_table
->
alias
),
cs
);
qpt->table_name.
append
(real_table->alias, strlen(real_table->alias), cs);
}
}
/* "partitions" column */
/* "partitions" column */
...
@@ -23481,19 +23482,22 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
...
@@ -23481,19 +23482,22 @@ int JOIN::save_qpf(QPF_query *output, bool need_tmp_table, bool need_order,
output->add_node(qp_sel);
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
();
if (qp_sel)
unit
;
unit
=
unit
->
next_unit
())
{
{
/*
for (SELECT_LEX_UNIT *unit= join->select_lex->first_inner_unit();
Display subqueries only if they are not parts of eliminated WHERE/ON
unit;
clauses.
unit= unit->next_unit())
*/
if
(
!
(
unit
->
item
&&
unit
->
item
->
eliminated
))
{
{
qp_sel
->
add_child
(
unit
->
first_select
()
->
select_number
);
/*
Display subqueries only if they are not parts of eliminated WHERE/ON
clauses.
*/
if (!(unit->item && unit->item->eliminated))
{
qp_sel->add_child(unit->first_select()->select_number);
}
}
}
}
}
...
...
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