diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2014-06-24 19:41:43 +0400 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2014-06-24 19:41:43 +0400 |
commit | c08de06246f776c557b7795d53e2a956e156f533 (patch) | |
tree | 6c9ed33855eeb6c418fe390deef7f62db91d6d36 /sql/sql_parse.cc | |
parent | 581b889771447f7a9f33d467f0b5ef2aa96e072b (diff) | |
download | mariadb-git-c08de06246f776c557b7795d53e2a956e156f533.tar.gz |
MDEV-406: ANALYZE $stmt: get ANALYZE work for subqueries
- "ANALYZE $stmt" should discard select's output, but it should still
evaluate the output columns (otherwise, subqueries in select list
are not executed)
- SHOW EXPLAIN's code practice of calling JOIN::save_explain_data()
after JOIN::exec() is disastrous for ANALYZE, because it resets
all counters after the first execution. It is stopped
= "Late" test_if_skip_sort_order() calls explicitly update their part
of the query plan.
= Also, I had to rewrite I_S optimization to actually have optimization
and execution stages.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 42a3045cb1d..721bdbdc031 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5260,10 +5260,13 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables) { //psergey-todo: ANALYZE should hook in here... select_result *save_result; + Protocol *save_protocol; if (lex->analyze_stmt) { save_result= result; result= new select_send_analyze(); + save_protocol= thd->protocol; + thd->protocol= new Protocol_discard(thd); } else { @@ -5280,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; + thd->protocol= save_protocol; thd->lex->explain->send_explain(thd); if (result != lex->result) |