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, 5 insertions, 5 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index e3405d9c9d9..7daf3be1578 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -69,14 +69,14 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
Test if the user wants to delete all rows and deletion doesn't have
any side-effects (because of triggers), so we can use optimized
handler::delete_all_rows() method.
-
- If row-based replication is used, we also delete the table row by
- row.
+ We implement fast TRUNCATE for InnoDB even if triggers are present.
+ TRUNCATE ignores triggers.
*/
if (!using_limit && const_cond && (!conds || conds->val_int()) &&
!(specialflag & (SPECIAL_NO_NEW_FUNC | SPECIAL_SAFE_MODE)) &&
- !(table->triggers && table->triggers->has_delete_triggers()) &&
- !thd->current_stmt_binlog_row_based)
+ (thd->lex->sql_command == SQLCOM_TRUNCATE ||
+ !(table->triggers && table->triggers->has_delete_triggers()))
+ )
{
/* Update the table->file->stats.records number */
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);