How to Truncate a Table in MySQL
Last updated July 24, 2026 · By the SaturnSQL team
TRUNCATE TABLE removes all rows by dropping and recreating the table, which is much faster than DELETE and resets AUTO_INCREMENT. It cannot be rolled back in InnoDB, so be sure first.
TRUNCATE TABLE session_logs;TRUNCATE fails if the table is referenced by a foreign key from another table; DELETE FROM (slower, rollback-able, keeps AUTO_INCREMENT) is the fallback.
Run this in SaturnSQL
SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.
Try it free