1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +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:
Sergei Petrunia
2014-06-24 19:41:43 +04:00
parent 581b889771
commit c08de06246
13 changed files with 738 additions and 455 deletions

View File

@ -3959,19 +3959,21 @@ public:
virtual void cleanup();
};
/*
We need this class, because select_send::send_eof() will call ::my_eof.
See also class Protocol_discard.
*/
class select_send_analyze : public select_send
{
bool discard_data;
bool send_result_set_metadata(List<Item> &list, uint flags) { return 0; }
/*
ANALYZE-todo: we should call val_int() (or val_str() or whatever) to
compute the columns. If we don't, it's not full execution.
*/
int send_data(List<Item> &items) { return 0; }
bool send_eof() { return 0; }
void abort_result_set() {}
};
class select_to_file :public select_result_interceptor {
protected:
sql_exchange *exchange;