mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
WL#2985 "Partition pruning": addition2: perform partition pruning for
single-table UPDATE/DELETE.
This commit is contained in:
@ -100,6 +100,21 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
||||
/* Handler didn't support fast delete; Delete rows one by one */
|
||||
}
|
||||
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
if (prune_partitions(thd, table, conds))
|
||||
{
|
||||
free_underlaid_joins(thd, select_lex);
|
||||
thd->row_count_func= 0;
|
||||
send_ok(thd); // No matching records
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
/*
|
||||
Update the table->records number (note: we probably could remove the
|
||||
previous file->info() call)
|
||||
*/
|
||||
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
|
||||
#endif
|
||||
|
||||
table->used_keys.clear_all();
|
||||
table->quick_keys.clear_all(); // Can't use 'only index'
|
||||
select=make_select(table, 0, 0, conds, 0, &error);
|
||||
@ -111,13 +126,11 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
||||
free_underlaid_joins(thd, select_lex);
|
||||
thd->row_count_func= 0;
|
||||
send_ok(thd,0L);
|
||||
|
||||
/*
|
||||
We don't need to call reset_auto_increment in this case, because
|
||||
mysql_truncate always gives a NULL conds argument, hence we never
|
||||
get here.
|
||||
*/
|
||||
|
||||
DBUG_RETURN(0); // Nothing to delete
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user