diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2011-10-28 02:30:02 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2011-10-28 02:30:02 +0400 |
commit | ca020dfa9e8668ce52eaff92c157097bba671ec1 (patch) | |
tree | 24f6043a525155189e0cc3b7a41eb75e8377c3d3 /sql | |
parent | 286a751490cd109a470e30ef486755cd4922802d (diff) | |
download | mariadb-git-ca020dfa9e8668ce52eaff92c157097bba671ec1.tar.gz |
MWL#182: Explain running statements
- Get subqueries to work, part #1.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_lex.cc | 17 | ||||
-rw-r--r-- | sql/sql_select.cc | 11 |
2 files changed, 26 insertions, 2 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 9aee5caeb64..3b355a312af 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -3706,6 +3706,22 @@ int st_select_lex::print_explain(select_result_sink *output) FALSE, // bool need_order, FALSE, // bool distinct, NULL); //const char *message + if (res) + goto err; + + for (SELECT_LEX_UNIT *unit= join->select_lex->first_inner_unit(); + unit; + unit= unit->next_unit()) + { + /* + Display subqueries only if they are not parts of eliminated WHERE/ON + clauses. + */ + if (!(unit->item && unit->item->eliminated)) + { + unit->print_explain(output); + } + } } else { @@ -3717,6 +3733,7 @@ int st_select_lex::print_explain(select_result_sink *output) FALSE, // bool distinct, msg); //const char *message } +err: return 0; } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 4dc99cf006c..fcbd2615b9c 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -265,7 +265,9 @@ void dbug_serve_apcs(THD *thd, int n_calls) /* - Usage + Debugging: check if @name=value, comparing as integer + + Intended usage: DBUG_EXECUTE_IF("show_explain_probe_2", if (dbug_user_var_equals_int(thd, "select_id", select_id)) @@ -2102,7 +2104,6 @@ void JOIN::exec_inner() int tmp_error; DBUG_ENTER("JOIN::exec"); - DBUG_EXECUTE_IF("show_explain_probe_2", dbug_serve_apcs(thd, 1);); DBUG_EXECUTE_IF("show_explain_probe_1", if (dbug_user_var_equals_int(thd, "show_explain_probe_select_id", @@ -20516,6 +20517,7 @@ void JOIN::clear() } } + int print_fake_select_lex_join(select_result_sink *result, bool on_the_fly, SELECT_LEX *select_lex, uint8 select_options) { @@ -20594,6 +20596,7 @@ int print_fake_select_lex_join(select_result_sink *result, bool on_the_fly, return 0; } + /** EXPLAIN handling. @@ -21162,6 +21165,10 @@ int JOIN::print_explain(select_result_sink *result, bool on_the_fly, } +/* + See st_select_lex::print_explain() for the SHOW EXPLAIN counterpart +*/ + static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, bool distinct,const char *message) { |