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 or set profiles.default.database_atomic_wait_for_drop_and_detach_synchronously to 1, for example, drop table t1 SYNC;.
To configure this parameter, do the following:
Log in to FusionInsight Manager and choose Cluster > Services > ClickHouse. Click Configurations then All Configurations, search for database_atomic_wait_for_drop_and_detach_synchronously in the search box in the upper right corner, change the value of profiles.default.database_atomic_wait_for_drop_and_detach_synchronously to 1, and save the configuration. Then, restart the ClickHouse service.
- 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;.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot