Documentation Home
MySQL 5.7 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 35.1Mb
PDF (A4) - 35.2Mb
Man Pages (TGZ) - 256.4Kb
Man Pages (Zip) - 361.2Kb
Info (Gzip) - 3.4Mb
Info (Zip) - 3.4Mb
Excerpts from this Manual

16.4.1.35 Replication and TRUNCATE TABLE

TRUNCATE TABLE is normally regarded as a DML statement, and so would be expected to be logged and replicated using row-based format when the binary logging mode isROW orMIXED. However this caused issues when logging or replicating, inSTATEMENT orMIXED mode, tables that used transactional storage engines such asInnoDB when the transaction isolation level wasREAD COMMITTED orREAD UNCOMMITTED, which precludes statement-based logging.

TRUNCATE TABLE is treated for purposes of logging and replication as DDL rather than DML so that it can be logged and replicated as a statement. However, the effects of the statement as applicable toInnoDB and other transactional tables on replicas still follow the rules described inSection 13.1.34, “TRUNCATE TABLE Statement” governing such tables. (Bug #36763)