diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2020-04-02 11:50:47 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2020-04-02 11:50:47 +0300 |
commit | a21900663626647a7b6f4904fa564f05df38ff5f (patch) | |
tree | f7eb060b1e191b1ba450681290e362c701d569f0 /sql/opt_trace.cc | |
parent | bdcecfa22cc2eb255610f5574ff0a91c8d247066 (diff) | |
download | mariadb-git-a21900663626647a7b6f4904fa564f05df38ff5f.tar.gz |
MDEV-22014: Rowid Filtering is not displayed well in the optimizer trace
- Print the rowid filters that are available for use with each table.
- Make print_best_access_for_table() print which filter it has picked.
- Make best_access_path() print the filter for considered ref accesses.
Diffstat (limited to 'sql/opt_trace.cc')
-rw-r--r-- | sql/opt_trace.cc | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/sql/opt_trace.cc b/sql/opt_trace.cc index afb188ceeb0..9957e524e90 100644 --- a/sql/opt_trace.cc +++ b/sql/opt_trace.cc @@ -24,6 +24,8 @@ #include "my_json_writer.h" #include "sp_head.h" +#include "rowid_filter.h" + const char I_S_table_name[]= "OPTIMIZER_TRACE"; /** @@ -661,14 +663,17 @@ void print_best_access_for_table(THD *thd, POSITION *pos, { DBUG_ASSERT(thd->trace_started()); - Json_writer_object trace_best_access(thd, "chosen_access_method"); - trace_best_access.add("type", type == JT_ALL ? "scan" : - join_type_str[type]); - trace_best_access.add("records", pos->records_read); - trace_best_access.add("cost", pos->read_time); - trace_best_access.add("uses_join_buffering", pos->use_join_buffer); - trace_best_access.add("filter_used", - pos->range_rowid_filter_info != NULL); + Json_writer_object obj(thd, "chosen_access_method"); + obj.add("type", type == JT_ALL ? "scan" : join_type_str[type]); + obj.add("records", pos->records_read); + obj.add("cost", pos->read_time); + obj.add("uses_join_buffering", pos->use_join_buffer); + if (pos->range_rowid_filter_info) + { + uint key_no= pos->range_rowid_filter_info->key_no; + obj.add("rowid_filter_key", + pos->table->table->key_info[key_no].name); + } } |