TRUNCATE
Remove all rows from a table without logging individual row deletions.
truncate table truncate
delete truncate bulk
| Database | Status | Syntax Family | Min Version |
|---|---|---|---|
| PostgreSQL | full | truncate | - |
| MySQL | full | truncate | - |
| MariaDB | full | truncate | - |
| Oracle | full | truncate | - |
| SQL Server | full | truncate | - |
| SQLite | workaround | delete-all | - |
| Redshift | full | truncate | - |
| DB2 | full | truncate | - |
| Snowflake | full | truncate | - |
| BigQuery | full | truncate | - |
Compare Databases
Database Details
PostgreSQL
full
TRUNCATE TABLE orders CASCADE;- Transactional - can be rolled back.
- Supports CASCADE to truncate dependent tables.
- Supports RESTART IDENTITY / CONTINUE IDENTITY.
- Fires BEFORE TRUNCATE and AFTER TRUNCATE triggers.
Docs: TRUNCATE
MySQL
full
TRUNCATE TABLE orders;- Not transactional - causes an implicit commit.
- Resets AUTO_INCREMENT counter.
- Cannot TRUNCATE a table referenced by a foreign key.
Docs: TRUNCATE TABLE
MariaDB
full
TRUNCATE TABLE orders;- Same behavior as MySQL - implicit commit, resets AUTO_INCREMENT.
Docs: TRUNCATE TABLE
Oracle
full
TRUNCATE TABLE orders;- DDL statement - causes an implicit commit.
- Supports CASCADE to truncate child tables with ON DELETE CASCADE.
- Cannot be rolled back.
Docs: TRUNCATE TABLE
SQL Server
full
TRUNCATE TABLE orders;- Minimally logged; can be rolled back within a transaction.
- Resets IDENTITY counter.
- Cannot truncate tables with foreign key references.
Docs: TRUNCATE TABLE
SQLite
workaround
DELETE FROM orders;- SQLite does not have a TRUNCATE statement.
- DELETE FROM table without a WHERE clause is optimized internally.
- To reset ROWID, follow with DELETE FROM sqlite_sequence WHERE name='table'.
Docs: DELETE
Redshift
full
TRUNCATE TABLE orders;- TRUNCATE is transactional in Redshift and can be rolled back.
- Faster than DELETE with no WHERE clause.
- Does not fire triggers (Redshift has none).
Docs: TRUNCATE
DB2
full
TRUNCATE TABLE orders IMMEDIATE;- Requires IMMEDIATE keyword.
- Supports REUSE STORAGE and DROP STORAGE options.
Docs: TRUNCATE
Snowflake
full
TRUNCATE TABLE orders;- Snowflake classifies TRUNCATE as a DML statement (not DDL), so it participates in transactions and can be rolled back.
- Truncated data is also recoverable via Time Travel within the table's data retention period.
Docs: TRUNCATE TABLE, Transactions
BigQuery
full
TRUNCATE TABLE orders;- Supported for standard tables.
- Not supported for external tables or views.
Docs: TRUNCATE TABLE