MySQL 9.1.0
Source Code Documentation
sql_delete.cc File Reference
#include "sql/sql_delete.h"
#include <assert.h>
#include <limits.h>
#include <sys/types.h>
#include <atomic>
#include <memory>
#include <utility>
#include "lex_string.h"
#include "mem_root_deque.h"
#include "my_alloc.h"
#include "my_base.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_sys.h"
#include "my_table_map.h"
#include "mysql_com.h"
#include "mysqld_error.h"
#include "scope_guard.h"
#include "sql/auth/auth_acls.h"
#include "sql/auth/auth_common.h"
#include "sql/binlog.h"
#include "sql/debug_sync.h"
#include "sql/filesort.h"
#include "sql/handler.h"
#include "sql/item.h"
#include "sql/iterators/delete_rows_iterator.h"
#include "sql/iterators/row_iterator.h"
#include "sql/join_optimizer/access_path.h"
#include "sql/join_optimizer/bit_utils.h"
#include "sql/join_optimizer/walk_access_paths.h"
#include "sql/key_spec.h"
#include "sql/mem_root_array.h"
#include "sql/mysqld.h"
#include "sql/opt_explain.h"
#include "sql/opt_explain_format.h"
#include "sql/opt_trace.h"
#include "sql/psi_memory_key.h"
#include "sql/query_options.h"
#include "sql/query_result.h"
#include "sql/range_optimizer/partition_pruning.h"
#include "sql/range_optimizer/path_helpers.h"
#include "sql/range_optimizer/range_optimizer.h"
#include "sql/sql_base.h"
#include "sql/sql_bitmap.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_error.h"
#include "sql/sql_executor.h"
#include "sql/sql_lex.h"
#include "sql/sql_list.h"
#include "sql/sql_opt_exec_shared.h"
#include "sql/sql_optimizer.h"
#include "sql/sql_resolver.h"
#include "sql/sql_select.h"
#include "sql/sql_update.h"
#include "sql/sql_view.h"
#include "sql/system_variables.h"
#include "sql/table.h"
#include "sql/table_trigger_dispatcher.h"
#include "sql/thd_raii.h"
#include "sql/transaction_info.h"
#include "sql/trigger_def.h"
#include "sql/uniques.h"

Classes

class  anonymous_namespace{sql_delete.cc}::Query_result_delete
 

Namespaces

namespace  anonymous_namespace{sql_delete.cc}
 

Functions

bool anonymous_namespace{sql_delete.cc}::DeleteCurrentRowAndProcessTriggers (THD *thd, TABLE *table, bool invoke_before_triggers, bool invoke_after_triggers, ha_rows *deleted_rows)
 
int refpos_order_cmp (const void *arg, const void *a, const void *b)
 
void SetUpTablesForDelete (THD *thd, JOIN *join)
 Sets various flags in the TABLE and handler objects associated with the target tables of a DELETE statement, in order to make them ready to be deleted from. More...
 
bool CheckSqlSafeUpdate (THD *thd, const JOIN *join)
 Checks if the sql_safe_updates option is enabled, and raises an error and returns true if the statement is likely to delete or update a large number of rows. More...
 
table_map GetImmediateDeleteTables (const JOIN *join, table_map delete_tables)
 Find out which of the delete target tables can be deleted from immediately while scanning. More...
 

Function Documentation

◆ CheckSqlSafeUpdate()

bool CheckSqlSafeUpdate ( THD thd,
const JOIN join 
)

Checks if the sql_safe_updates option is enabled, and raises an error and returns true if the statement is likely to delete or update a large number of rows.

Specifically, it raises an error if there is a full table scan or full index scan of one of the tables deleted from, and there is no LIMIT clause.

◆ GetImmediateDeleteTables()

table_map GetImmediateDeleteTables ( const JOIN join,
table_map  delete_tables 
)

Find out which of the delete target tables can be deleted from immediately while scanning.

This is used by the old optimizer after the plan has been created. The hypergraph optimizer does not use this function, as it makes the decision about immediate delete during planning, not after planning.

◆ refpos_order_cmp()

int refpos_order_cmp ( const void *  arg,
const void *  a,
const void *  b 
)

◆ SetUpTablesForDelete()

void SetUpTablesForDelete ( THD thd,
JOIN join 
)

Sets various flags in the TABLE and handler objects associated with the target tables of a DELETE statement, in order to make them ready to be deleted from.

Parameters
thdThe session object.
joinThe top-level JOIN object of the DELETE operation.