question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Synchronous mutation and classic update/delete statement support

See original GitHub issue

Mutation executes asynchronously in ClickHouse. And unlike other databases following SQL standard, it uses DDL instead of DML. As a result, this may break assumption in certain tools and generate overhead in downstream applications.

In order to follow standards, I hope we can:

  1. introduce a new connection setting mutationsSync(same as mutations_sync in ClickHouse) defaults to 1, meaning synchronous mutation
  2. <no longer needed as it’s going to be implemented on server-side> take classic update/delete and transform them into ALTER TABLE... for mutation in ClickHouse So if you give UPDATE tbl SET col1=1, col2=2 WHERE col3=3, it will be translated into ALTER TABLE tbl UPDATE col1=1, col2=2 WHERE col3=3.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
filimonovcommented, Jan 19, 2021

2 is a bad idea. Mutations were made this way (with special syntax) intentionally - current ALTER UPDATE / DELETE are very expensive operations, which should be used with care, not too often.

Drivers should NOT introduce any magic to pretend that clickhouse has updates or deletes (hopefully they will be added in 2021).

0reactions
zhicwucommented, Apr 20, 2021

Before light-weight mutation in place, since multi-statement SQL is now supported, we can run SQL like below in one run - session will be enabled automatically if the SQL contains multiple statements:

set mutations_sync = 1;

ALTER TABLE tbl UPDATE col1=1, col2=2 WHERE col3=3;
Read more comments on GitHub >

github_iconTop Results From Across the Web

Insert, update, and delete data using mutations | Cloud Spanner
A mutation represents a sequence of inserts, updates, and deletes that Spanner applies atomically to different rows and tables in a Spanner database....
Read more >
Updates and Deletes in ClickHouse - Altinity
ClickHouse team wanted to express the difference from traditional SQL: new updates and deletes are batch operations, performed asynchronously.
Read more >
Settings | ClickHouse Docs
User-level setting that allows mutations on replicated tables to make use of non-deterministic functions such as dictGet . Given that, for example, dictionaries ......
Read more >
Is it possible to delete old records from clickhouse table?
2. Instead of delete where 1=1 which adds a mutation, I've been using TRUNCATE TABLE <table> which synchronously removes all data from table ......
Read more >
HCatalog Streaming Mutation API
But while Hive itself supports INSERT , UPDATE and DELETE commands, and the ORC format can support large batches of mutations in a ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found