diff options
author | Igor Babaev <igor@askmonty.org> | 2022-06-03 20:05:31 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2022-06-03 20:05:31 -0700 |
commit | d5d8695423ff9ed8fb245fe1dd1cf38d1c57856e (patch) | |
tree | eeb040274853c1a1276361679a464772d62ab3bc /sql/sql_update.cc | |
parent | 1f0333db90fb942b2a8435733184460ca3c56288 (diff) | |
download | mariadb-git-bb-10.7-mdev-7487.tar.gz |
MDEV-7487 Semi-join optimization for single-table UPDATE/DELETEsbb-10.7-mdev-7487
This is a preliminary patch.
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r-- | sql/sql_update.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 0ed25c3913d..7c48f8eaded 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -2671,6 +2671,8 @@ int multi_update::do_updates() table = cur_table->table; if (table == table_to_update) continue; // Already updated + if (table->file->pushed_rowid_filter) + table->file->disable_pushed_rowid_filter(); org_updated= updated; tmp_table= tmp_tables[cur_table->shared]; tmp_table->file->extra(HA_EXTRA_CACHE); // Change to read cache @@ -2865,7 +2867,8 @@ int multi_update::do_updates() check_opt_it.rewind(); while (TABLE *tbl= check_opt_it++) tbl->file->ha_rnd_end(); - + if (table->file->save_pushed_rowid_filter) + table->file->enable_pushed_rowid_filter(); } DBUG_RETURN(0); @@ -2876,6 +2879,8 @@ err: } err2: + if (table->file->save_pushed_rowid_filter) + table->file->enable_pushed_rowid_filter(); if (table->file->inited) (void) table->file->ha_rnd_end(); if (tmp_table->file->inited) @@ -3126,6 +3131,11 @@ bool Sql_cmd_update::prepare_inner(THD *thd) goto err; } + if (!multitable && + select_lex->sj_subselects.elements && + !select_lex->order_list.elements && + select_lex->master_unit()->lim.get_select_limit() == HA_POS_ERROR) + multitable= true; } free_join= false; |