티스토리 뷰

반응형
DELETE FROM [<database>.]<table> WHERE <filter_expr>

ALTER TABLE website.clicks DELETE WHERE visitor_id in (253, 1002, 4277)

ClickHouse is an open-source column-oriented database management system. Here are some of its advantages:

  1. Performance: ClickHouse is designed for high-performance data analysis and can handle large amounts of data quickly and efficiently.
  2. Scalability: ClickHouse is highly scalable and can be easily distributed across multiple servers.
  3. Cost-effective: As an open-source solution, ClickHouse is free to use, making it a cost-effective alternative to proprietary databases.
  4. Column-oriented storage: ClickHouse uses a column-oriented storage system that reduces disk I/O and increases query performance.
  5. SQL support: ClickHouse supports SQL for querying data, making it familiar and easy to use for many users.
  6. Real-time analytics: ClickHouse supports real-time data processing and can handle large amounts of incoming data.
  7. Flexibility: ClickHouse supports a variety of data types and can be integrated with a range of systems and tools.

 

3~4년 전에 데이터웨어하우스 구축시에 ClickHouse 를 고려 했었는데, 제가 MariaDB ColumnStore를 선택한 이유는 저장된

데이터를 자주 변경해야 하는데, 당시에 ClickHouse는 Update 구문을 지원하지 않아서 였습니다.

오늘 최신 문서를 보니 업데이트를 지원하는데 구문이 표준 SQL과는 많이 다르네요.

https://clickhouse.com/docs/en/guides/developer/mutations/

 

Updating and Deleting ClickHouse Data | ClickHouse Docs

Although ClickHouse is geared toward high volume analytic workloads, it is possible in some situations to modify or delete existing data. These operations are labeled "mutations" and are executed using the ALTER TABLE command.

clickhouse.com

ALTER TABLE [<database>.]<table> UPDATE <column> = <expression> WHERE <filter_expr>

ALTER TABLE website.clicks UPDATE visitor_id = getDict('visitors', 'new_visitor_id', visitor_id) WHERE visit_date < '2022-01-01'

 

그런데, ChatGPT에서 ClickHouse에서 "Howto update in ClickHouse" 검색을 해보니 아래와 같이 답변을 주네요.

 

시간을 내어서 ClickHouse를 설치해서 ChatGPT의 답변을 검증해 봐야 겠습니다. 

 

 

 

 

 

반응형