summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2022-09-16 14:59:56 -0700
committerIgor Babaev <igor@askmonty.org>2022-09-16 22:38:17 -0700
commit7411169cdef1e63eaf7614d94815671b7af519d4 (patch)
tree35efe752b19893692bd913e9fad17b8e8cf6af65 /sql/sql_select.cc
parent4100aac0bd14e25c79339b3e23e6d1022b4e8d50 (diff)
downloadmariadb-git-bb-10.11-MDEV-7487.tar.gz
MDEV-7487 Semi-join optimization for single-table update/delete statementsbb-10.11-MDEV-7487
This patch allows to use semi-join optimization at the top level of single-table update and delete statements. The problem of supporting such optimization became easy to resolve after processing a single-table update/delete statement started using JOIN structure. This allowed to use JOIN::prepare() not only for multi-table updates/deletes but for single-table ones as well. This was done in the patch for mdev-28883: Re-design the upper level of handling UPDATE and DELETE statements. Note that JOIN::prepare() detects all subqueries that can be considered as candidates for semi-join optimization. The code added by this patch looks for such candidates at the top level and if such candidates are found in the processed single-table update/delete the statement is handled in the same way as a multi-table update/delete. Approved by Oleksandr Byelkin <sanja@mariadb.com>
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 3447364c850..125944c3a6b 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -5881,8 +5881,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
s->needed_reg=select->needed_reg;
select->quick=0;
impossible_range= records == 0 && s->table->reginfo.impossible_range;
- if (join->thd->lex->sql_command == SQLCOM_SELECT &&
- optimizer_flag(join->thd, OPTIMIZER_SWITCH_USE_ROWID_FILTER))
+ if (optimizer_flag(join->thd, OPTIMIZER_SWITCH_USE_ROWID_FILTER))
s->table->init_cost_info_for_usable_range_rowid_filters(join->thd);
}
if (!impossible_range)