databasereplicationdelete-rowclickhouse

How to delete rows from Replicated&Distributed tables on Clickhouse?


I have a table which is a distributed table over replicated tables in Clickhouse.

Although I have tried different things I can not delete any rows from the table. What should I do?

Delete queries I have tried.

delete from distributed_table where userid = 22387715
ALTER TABLE distributed_table on cluster cluster_name DELETE WHERE userid = 22387715

Solution

  • looked into this a little further. You can do the DELETE on the table, but you can't send the DELETE command to the distributed_table. You can send the DELETE command to the underlying data table however:

    ALTER TABLE underlying_data_table ON CLUSTER cluster_name DELETE
    WHERE userid = 22387715;
    

    Hope this helps, good luck