summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2022-10-17 16:44:10 -0700
committerIgor Babaev <igor@askmonty.org>2022-10-25 11:43:32 -0700
commit58cd0bd59ef011be54f162237f2ff017c3148e7b (patch)
tree7c6b5282b00ff9d9a509d85ff7d0ff996fa0d740 /sql/sql_insert.cc
parentf1bbc1cd19d0d81fee5433efcb570a8845172241 (diff)
downloadmariadb-git-58cd0bd59ef011be54f162237f2ff017c3148e7b.tar.gz
MDEV-28846 Poor performance when rowid filter contains no elements
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 patch also back-ports from 10.5 the code that properly sets the field TABLE::file::table for opened temporary tables. The test cases that were supposed to use rowid filters have been adjusted in order to use similar execution plans after this fix. Approved by Oleksandr Byelkin <sanja@mariadb.com>
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 76fd6385041..ca3de361865 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -4171,7 +4171,7 @@ void select_insert::abort_result_set()
table will be assigned with view table structure, but that table will
not be opened really (it is dummy to check fields types & Co).
*/
- if (table && table->file->get_table())
+ if (table && table->file->is_open())
{
bool changed, transactional_table;
/*