当前位置:网站首页>Update and delete operations in Clickhouse of data warehouse series

Update and delete operations in Clickhouse of data warehouse series

2022-06-09 08:45:00 Lang Xiaolin

Test data

select count(*) from system.columns where table='test_update';
select count(*) from test_update;

Specific deletion & Update implementation

 grammar   as follows :
ALTER TABLE <table_name> DELETE WHERE <filter>;
ALTER TABLE <table_name> UPDATE col1 = expr1, ... WHERE <filter>;

ALTER TABLE test_update UPDATE event_status_key=0 where event_status_key=22;

 The command is executed asynchronously , You can view the table  system.mutations  To check whether the command has been executed .

Clickhouse The update operation has some limitations :
 Index columns cannot be updated ;
 Distributed tables cannot be updated ;
ALTER TABLE UPDATE/DELETE Distributed... Is not supported DDL, So you need to manually on each node in a distributed environment local To update / Delete data ;
 Not suitable for frequent updates or point Update due to Clickhouse The update operation is very resource intensive , If you update frequently , The cluster may collapse , Please operate carefully .

Reference material :
http://t.zoukankan.com/wenBlog-p-15745238.html stay clickhouse Update and delete in

原网站

版权声明
本文为[Lang Xiaolin]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206090820324043.html