Clickhouse: What is the most efficient way to empty a table

Created on 7 Dec 2018  路  2Comments  路  Source: ClickHouse/ClickHouse

Hello all,

I need to wipe out all data in default.MyTable.

Method 1> drop table default.MyTable followed by re-creating default.MyTable
Method 2>
alter table default.MyTable drop partition '2018-11-03'
...
alter table default.MyTable drop partition '2018-12-03'

Question> The size of MyTable is around 400GB. Method 1 takes a very long time to finish dropping the table. Method 2 requires me to issue multiple statements to drop all existing partitions. Is there a more efficient way to empty the data within a table?

Thank you

question

Most helpful comment

Try truncate table default.MyTable?
More details: TRUNCATE

All 2 comments

Try truncate table default.MyTable?
More details: TRUNCATE

Thank you!

Was this page helpful?
0 / 5 - 0 ratings