summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 8dd611e4ccf..3a7cc38b097 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -230,8 +230,14 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
order= simple_remove_const(order, conds);
bool need_sort;
- usable_index= get_index_for_order(order, table, select, limit,
- &need_sort, &reverse);
+ if (select && select->quick && select->quick->unique_key_range())
+ { // Single row select (always "ordered")
+ need_sort= FALSE;
+ usable_index= MAX_KEY;
+ }
+ else
+ usable_index= get_index_for_order(order, table, select, limit,
+ &need_sort, &reverse);
if (need_sort)
{
DBUG_ASSERT(usable_index == MAX_KEY);