diff options
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index a17682bd9c8..3d231345b73 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -12619,6 +12619,18 @@ void JOIN_TAB::build_range_rowid_filter_if_needed() { if (rowid_filter && !is_rowid_filter_built) { + /** + The same handler object (table->file) is used to build a filter + and to perfom a primary table access (by the main query). + + To estimate the time for filter building tracker should be changed + and after building of the filter has been finished it should be + switched back to the previos tracker. + */ + Exec_time_tracker *table_tracker= table->file->get_time_tracker(); + Rowid_filter_tracker *rowid_tracker= rowid_filter->get_tracker(); + table->file->set_time_tracker(rowid_tracker->get_time_tracker()); + rowid_tracker->start_tracking(); if (!rowid_filter->build()) { is_rowid_filter_built= true; @@ -12628,6 +12640,8 @@ void JOIN_TAB::build_range_rowid_filter_if_needed() delete rowid_filter; rowid_filter= 0; } + rowid_tracker->stop_tracking(); + table->file->set_time_tracker(table_tracker); } } @@ -25408,8 +25422,10 @@ bool JOIN_TAB::save_explain_data(Explain_table_access *eta, erf->quick= quick->get_explain(thd->mem_root); erf->selectivity= range_rowid_filter_info->selectivity; erf->rows= quick->records; + if (!(erf->tracker= new Rowid_filter_tracker(thd->lex->analyze_stmt))) + return 1; + rowid_filter->set_tracker(erf->tracker); eta->rowid_filter= erf; - //psergey-todo: also do setup for ANALYZE here. } if (tab_type == JT_NEXT) |