Remove all rows from a table instantly, without logging individual row deletions.
Efficiently removes all rows from a table by deallocating pages rather than deleting row-by-row. Much faster than DELETE for full table clears. Cannot be rolled back in some databases without explicit transaction handling; check your engine.
Compatibility
| Database System | Support Status | Since Version | Notes |
|---|---|---|---|
| MySQL | Native | all | Resets AUTO_INCREMENT counter to its starting value. Cannot be rolled back in InnoDB without an explicit transaction. |
| PostgreSQL | Native | all | Uniquely transactional — can be rolled back within a transaction. Supports RESTART IDENTITY / CONTINUE IDENTITY (sequence handling) and CASCADE / RESTRICT (foreign key handling). |
| SQL Server | Native | all | Resets identity counter. Cannot truncate a table referenced by an active foreign key constraint. |
| Oracle | Native | all | DDL operation — implicitly commits the current transaction. Cannot be rolled back. |
| SQLite | Not Supported | - | No TRUNCATE command. Use DELETE FROM tbl (no WHERE clause). Reclaim space with VACUUM. |
Details
Much faster than DELETE on large tables because it deallocates data pages rather than logging row-by-row. PostgreSQL is unique in making TRUNCATE fully transactional. SQLite lacks the command entirely.
Standard Syntax
Version Support
Per-Database Syntax & Notes
MySQL Native syntax
Resets AUTO_INCREMENT counter to its starting value. Cannot be rolled back in InnoDB without an explicit transaction.
PostgreSQL Native syntax
Uniquely transactional — can be rolled back within a transaction. Supports RESTART IDENTITY / CONTINUE IDENTITY (sequence handling) and CASCADE / RESTRICT (foreign key handling).
SQL Server Native syntax
Resets identity counter. Cannot truncate a table referenced by an active foreign key constraint.
Oracle Native syntax
DDL operation — implicitly commits the current transaction. Cannot be rolled back.
SQLite Alternative syntax
No TRUNCATE command. Use DELETE FROM tbl (no WHERE clause). Reclaim space with VACUUM.