summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2006-01-26 20:17:17 +0300
committerunknown <sergefp@mysql.com>2006-01-26 20:17:17 +0300
commitd50236f69efd348d88d1b6671c40034fd02349a3 (patch)
tree21bd8ee020afae3e00f74f131c4da8b4bd6ae88c /sql/sql_delete.cc
parent77f51bf11a0a5cc7ad6bc9d1628d13a268dd1d4f (diff)
downloadmariadb-git-d50236f69efd348d88d1b6671c40034fd02349a3.tar.gz
WL#2985 "Partition pruning": addition2: perform partition pruning for
single-table UPDATE/DELETE. mysql-test/r/partition_pruning.result: WL#2985 "Partition pruning": addition2: perform partition pruning for UPDATE/DELETE: testcases added mysql-test/t/partition_pruning.test: WL#2985 "Partition pruning": addition2: perform partition pruning for UPDATE/DELETE: testcases added sql/sql_delete.cc: WL#2985 "Partition pruning": addition2: perform partition pruning for UPDATE/DELETE: Added partition pruning call in mysql_delete() sql/sql_update.cc: WL#2985 "Partition pruning": addition2: perform partition pruning for UPDATE/DELETE: Added partition pruning call in mysql_update()
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 7d8f8f12383..f4c857f3785 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -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
}