Updated on 2022-11-04 GMT+08:00

DROP: Deleting a Table

This section describes the basic syntax and usage of the SQL statement for deleting a ClickHouse table.

Basic Syntax

DROP [TEMPORARY] TABLE [IF EXISTS] [database_name.]name [ON CLUSTER cluster] [SYNC]

Example

-- Delete the t1 table.
drop table t1 SYNC;

When you delete a replication table, create a path on ZooKeeper to store related data. The default library engine of ClickHouse is the atomic database engine. After a table in the atomic database is deleted, it is not deleted immediately but deleted 480 seconds later. To resolve this issue, when deleting a table, add the SYNC field to the deletion command, for example, drop table t1 SYNC;.

This issue does not occur when a local or distributed table is deleted. The SYNC field is not required in your deletion command, for example, drop table t1;.