diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2011-04-02 14:04:45 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2011-04-02 14:04:45 +0400 |
commit | 997445bc8eb578355b41abc3f4e42f579f900043 (patch) | |
tree | 1224e5382ffa0b158db9d4d109114ba28b6c361d /sql/sql_join_cache.cc | |
parent | 886d84d6d15f17d91a37453875b386167a9fef76 (diff) | |
download | mariadb-git-997445bc8eb578355b41abc3f4e42f579f900043.tar.gz |
Make EXPLAIN better at displaying MRR/BKA:
- "Using MRR" is no longer shown with range access.
- Instead, both range and BKA accesses will show one of the following:
= "Rowid-ordered scan"
= "Key-ordered scan"
= "Key-ordered Rowid-ordered scan"
depending on whether DS-MRR implementation will do scan keys in order, rowids in order,
or both.
- The patch also introduces a way for other storage engines/MRR implementations to
pass information to EXPLAIN output about the properties of employed MRR scans.
Diffstat (limited to 'sql/sql_join_cache.cc')
-rw-r--r-- | sql/sql_join_cache.cc | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc index e952cf3e2ef..44b953a27fb 100644 --- a/sql/sql_join_cache.cc +++ b/sql/sql_join_cache.cc @@ -2491,8 +2491,36 @@ void JOIN_CACHE::print_explain_comment(String *str) str->append(join_alg); str->append(STRING_WITH_LEN(" join")); str->append(STRING_WITH_LEN(")")); - } - +} + + +static void add_mrr_explain_info(String *str, uint mrr_mode, handler *file) +{ + char mrr_str_buf[128]={0}; + int len; + len= file->multi_range_read_explain_info(mrr_mode, mrr_str_buf, + sizeof(mrr_str_buf)); + if (len > 0) + { + str->append(STRING_WITH_LEN("; ")); + str->append(mrr_str_buf, len); + } +} + + +void JOIN_CACHE_BKA::print_explain_comment(String *str) +{ + JOIN_CACHE::print_explain_comment(str); + add_mrr_explain_info(str, mrr_mode, join_tab->table->file); +} + + +void JOIN_CACHE_BKAH::print_explain_comment(String *str) +{ + JOIN_CACHE::print_explain_comment(str); + add_mrr_explain_info(str, mrr_mode, join_tab->table->file); +} + /* Initialize a hashed join cache |