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_delete.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_delete.cc')
-rw-r--r-- | sql/sql_delete.cc | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index d0c304fc14f..fda74481f11 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -52,9 +52,11 @@ invoked on a running DELETE statement. */ -void Delete_plan::save_explain_data(MEM_ROOT *mem_root, Explain_query *query) +Explain_delete* Delete_plan::save_explain_delete_data(MEM_ROOT *mem_root, THD *thd) { - Explain_delete *explain= new (mem_root) Explain_delete(mem_root); + Explain_query *query= thd->lex->explain; + Explain_delete *explain= + new (mem_root) Explain_delete(mem_root, thd->lex->analyze_stmt); if (deleting_all_rows) { @@ -69,14 +71,19 @@ void Delete_plan::save_explain_data(MEM_ROOT *mem_root, Explain_query *query) } query->add_upd_del_plan(explain); + return explain; } -void Update_plan::save_explain_data(MEM_ROOT *mem_root, Explain_query *query) +Explain_update* +Update_plan::save_explain_update_data(MEM_ROOT *mem_root, THD *thd) { - Explain_update* explain= new (mem_root) Explain_update(mem_root); + Explain_query *query= thd->lex->explain; + Explain_update* explain= + new (mem_root) Explain_update(mem_root, thd->lex->analyze_stmt); save_explain_data_intern(mem_root, query, explain); query->add_upd_del_plan(explain); + return explain; } @@ -461,7 +468,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, if (thd->lex->describe) goto produce_explain_and_leave; - query_plan.save_explain_data(thd->mem_root, thd->lex->explain); + explain= query_plan.save_explain_delete_data(thd->mem_root, thd); + ANALYZE_START_TRACKING(&explain->command_tracker); DBUG_EXECUTE_IF("show_explain_probe_delete_exec_start", dbug_serve_apcs(thd, 1);); @@ -542,7 +550,6 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, explain= (Explain_delete*)thd->lex->explain->get_upd_del_plan(); explain->tracker.on_scan_init(); - ANALYZE_START_TRACKING(&explain->time_tracker); while (!(error=info.read_record(&info)) && !thd->killed && ! thd->is_error()) @@ -620,7 +627,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, end_read_record(&info); if (options & OPTION_QUICK) (void) table->file->extra(HA_EXTRA_NORMAL); - ANALYZE_STOP_TRACKING(&explain->time_tracker); + ANALYZE_STOP_TRACKING(&explain->command_tracker); cleanup: /* @@ -701,7 +708,7 @@ produce_explain_and_leave: We come here for various "degenerate" query plans: impossible WHERE, no-partitions-used, impossible-range, etc. */ - query_plan.save_explain_data(thd->mem_root, thd->lex->explain); + query_plan.save_explain_delete_data(thd->mem_root, thd); send_nothing_and_leave: /* |