diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2015-04-07 01:29:17 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2015-04-07 01:29:17 +0300 |
commit | 2af935c8ec238f57d4ed909a8876031bd36dbb4d (patch) | |
tree | 5e802608372b90a9e7c28941aab8a7507d607458 /sql/sql_select.cc | |
parent | 2936fb127d551a1abd6f30bdfd50a8a9bcf4e41b (diff) | |
download | mariadb-git-2af935c8ec238f57d4ed909a8876031bd36dbb4d.tar.gz |
MDEV-7899: 10.1 is 3% slower than 10.0 in OLTP RO
- Remove ANALYZE's timing code off the the execution path of regular
SELECTs.
- Improve the tracker that tracks counts/execution times of SELECTs or
DML statements:
= regular execution just increments counters
= ANALYZE will also collect timings.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index c087732bab1..dd9b8bd4ac4 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -23441,8 +23441,11 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab tab->tracker= &eta->tracker; tab->jbuf_tracker= &eta->jbuf_tracker; - tab->table->file->tracker= &eta->op_tracker; - /* id and select_type are kept in Explain_select */ + /* Enable the table access time tracker only for "ANALYZE stmt" */ + if (thd->lex->analyze_stmt) + tab->table->file->tracker= &eta->op_tracker; + + /* No need to save id and select_type here, they are kept in Explain_select */ /* table */ if (table->derived_select_number) @@ -23864,12 +23867,15 @@ int JOIN::save_explain_data_intern(Explain_query *output, bool need_tmp_table, if (message) { Explain_select *xpl_sel; - explain_node= xpl_sel= new (output->mem_root) Explain_select(output->mem_root); + explain_node= xpl_sel= + new (output->mem_root) Explain_select(output->mem_root, + thd->lex->analyze_stmt); join->select_lex->set_explain_type(true); xpl_sel->select_id= join->select_lex->select_number; xpl_sel->select_type= join->select_lex->type; xpl_sel->message= message; + tracker= &xpl_sel->time_tracker; if (select_lex->master_unit()->derived) xpl_sel->connection_type= Explain_node::EXPLAIN_NODE_DERIVED; /* Setting xpl_sel->message means that all other members are invalid */ @@ -23878,7 +23884,9 @@ int JOIN::save_explain_data_intern(Explain_query *output, bool need_tmp_table, else { Explain_select *xpl_sel; - explain_node= xpl_sel= new (output->mem_root) Explain_select(output->mem_root); + explain_node= xpl_sel= + new (output->mem_root) Explain_select(output->mem_root, + thd->lex->analyze_stmt); table_map used_tables=0; tracker= &xpl_sel->time_tracker; |