mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-7487 Semi-join optimization for single-table update/delete statements
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>
This commit is contained in:
@@ -567,11 +567,11 @@ bool SELECT_LEX::is_sj_conversion_prohibited(THD *thd)
|
||||
switch (thd->lex->sql_command) {
|
||||
case SQLCOM_UPDATE:
|
||||
return
|
||||
!((Sql_cmd_update *) cmd)->is_multitable() ||
|
||||
!((Sql_cmd_update *) cmd)->is_multitable() &&
|
||||
((Sql_cmd_update *) cmd)->processing_as_multitable_update_prohibited(thd);
|
||||
case SQLCOM_DELETE:
|
||||
return
|
||||
!((Sql_cmd_delete *) cmd)->is_multitable() ||
|
||||
!((Sql_cmd_delete *) cmd)->is_multitable() &&
|
||||
((Sql_cmd_delete *) cmd)->processing_as_multitable_delete_prohibited(thd);
|
||||
default:
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user