summaryrefslogtreecommitdiff
path: root/sql/sql_explain.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2022-10-25 18:07:27 -0700
committerIgor Babaev <igor@askmonty.org>2022-10-25 18:07:27 -0700
commiteee0fda325fcf353ea863c87a46ff2995eb1711f (patch)
tree6117cd851fd12973e5fddfe6acc42056e9722317 /sql/sql_explain.cc
parent42802ad66c49b6de11b37c7ea4e4658ccc5a94aa (diff)
downloadmariadb-git-bb-10.5-MDEV-28846.tar.gz
MDEV-28846 Poor performance when rowid filter contains no elementsbb-10.5-MDEV-28846
When a range rowid filter was used with an index ref access the cost of accessing the index entries for the records rejected by the filter was not taken into account. For a ref access by an index with big average number of records per key this led to poor execution plans if selectivity of the used filter was high. The patch resolves this problem. It also introduces a minor optimization that skips look-ups into a filter that turns out to be empty. With this patch the output of ANALYZE stmt reports the number of look-ups into used rowid filters. The test cases that were supposed to use rowid filters have been adjusted in order to use similar execution plans after this fix. This patch prepared for 10.5 differs from the patch resolving the problem for 10.4 because he code that calculates the cost of index only access has been changed for 10.5 making usage of rowid filters more favorable. Approved by Oleksandr Byelkin <sanja@mariadb.com>
Diffstat (limited to 'sql/sql_explain.cc')
-rw-r--r--sql/sql_explain.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc
index 539e427ee2f..1b59dce10b9 100644
--- a/sql/sql_explain.cc
+++ b/sql/sql_explain.cc
@@ -1676,6 +1676,7 @@ void Explain_rowid_filter::print_explain_json(Explain_query *query,
if (is_analyze)
{
writer->add_member("r_rows").add_double(tracker->get_container_elements());
+ writer->add_member("r_lookups").add_ll(tracker->get_container_lookups());
writer->add_member("r_selectivity_pct").
add_double(tracker->get_r_selectivity_pct() * 100.0);
writer->add_member("r_buffer_size").