mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
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.
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user