How to Truncate a Table in ClickHouse

Last updated July 25, 2026 · By the SaturnSQL team

TRUNCATE TABLE removes all rows immediately while keeping the table definition. It cannot be undone, so double-check the table name. To remove only old data, DROP PARTITION or TTL are the better tools.

TRUNCATE drops every data part rather than deleting row by row, so it returns almost immediately no matter how large the table is. There is no transaction to roll back. On a cluster, add ON CLUSTER your_cluster or you will only clear the replica you happen to be connected to.

TRUNCATE TABLE session_logs;

Avoid errors in scripts

IF EXISTS turns a missing table into a no-op instead of an error, which matters in teardown scripts and scheduled jobs that might run before the table is created. If you only want to remove old data rather than all of it, ALTER TABLE ... DROP PARTITION clears one partition and a TTL clause expires rows automatically.

TRUNCATE TABLE IF EXISTS session_logs;

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

Related ClickHouse guides