Skip to content

Commit c7763b6

Browse files
committed
remove cloud badge from lightweight updates
1 parent 00d009c commit c7763b6

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

docs/en/guides/developer/lightweight-update.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@ title: Lightweight Update
55
keywords: [lightweight update]
66
---
77

8-
import CloudAvailableBadge from '@theme/badges/CloudAvailableBadge';
9-
108
## Lightweight Update
119

12-
<CloudAvailableBadge/>
13-
1410
When lightweight updates are enabled, updated rows are marked as updated immediately and subsequent `SELECT` queries will automatically return with the changed values. When lightweight updates are not enabled, you may have to wait for your mutations to be applied via a background process to see the changed values.
1511

1612
Lightweight updates can be enabled for `MergeTree`-family tables by enabling the query-level setting `apply_mutations_on_fly`.
@@ -23,7 +19,7 @@ SET apply_mutations_on_fly = 1;
2319

2420
Let's create a table and run some mutations:
2521
```sql
26-
CREATE TABLE test_on_fly_mutations (id UInt64, v String)
22+
CREATE TABLE test_on_fly_mutations (id UInt64, v String)
2723
ENGINE = MergeTree ORDER BY id;
2824

2925
-- Disable background materialization of mutations to showcase
@@ -93,4 +89,4 @@ These behaviours are controlled by the following settings:
9389
- `mutations_execute_nondeterministic_on_initiator` - if true, non-deterministic functions are executed on the initiator replica and are replaced as literals in `UPDATE` and `DELETE` queries. Default value: `false`.
9490
- `mutations_execute_subqueries_on_initiator` - if true, scalar subqueries are executed on the initiator replica and are replaced as literals in `UPDATE` and `DELETE` queries. Default value: `false`.
9591
- `mutations_max_literal_size_to_replace` - The maximum size of serialized literals in bytes to replace in `UPDATE` and `DELETE` queries. Default value: `16384` (16 KiB).
96-
92+

docs/en/managing-data/updating-data/overview.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ description: How to update data in ClickHouse
55
keywords: [update, updating data]
66
---
77

8-
import CloudAvailableBadge from '@theme/badges/CloudAvailableBadge';
9-
108
## Differences between updating data in ClickHouse and OLTP databases
119

12-
When it comes to handling updates, ClickHouse and OLTP databases diverge significantly due to their underlying design philosophies and target use cases. For example, PostgreSQL, a row-oriented, ACID-compliant relational database, supports robust and transactional update and delete operations, ensuring data consistency and integrity through mechanisms like Multi-Version Concurrency Control (MVCC). This allows for safe and reliable modifications even in high-concurrency environments.
10+
When it comes to handling updates, ClickHouse and OLTP databases diverge significantly due to their underlying design philosophies and target use cases. For example, PostgreSQL, a row-oriented, ACID-compliant relational database, supports robust and transactional update and delete operations, ensuring data consistency and integrity through mechanisms like Multi-Version Concurrency Control (MVCC). This allows for safe and reliable modifications even in high-concurrency environments.
1311

1412
Conversely, ClickHouse is a column-oriented database optimized for read-heavy analytics and high throughput append-only operations. While it does natively support in-place updates and delete, they must be used carefully to avoid high I/O. Alternatively, tables can be restructured to convert delete and update into appended operations where they are processed asynchronously and/or at read time, thus reflecting the focus on high-throughput data ingestion and efficient query performance over real-time data manipulation.
1513

@@ -24,15 +22,15 @@ In summary, update operations should be issued carefully, and the mutations queu
2422
| Method | Syntax | When to use |
2523
|---------------------------------------------------------------------------------------|--------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
2624
| [Update mutation](/en/sql-reference/statements/alter/update) | `ALTER TABLE [table] UPDATE` | Use when data must be updated to disk immediately (e.g. for compliance). Negatively affects `SELECT` performance. |
27-
| [Lightweight update](/en/guides/developer/lightweight-update) (ClickHouse Cloud) | `ALTER TABLE [table] UPDATE` | Enable using `SET apply_mutations_on_fly = 1;`. Use when updating small amounts of data. Rows are immediately returned with updated data in all subsequent `SELECT` queries but are initially only internally marked as updated on disk. |
25+
| [Lightweight update](/en/guides/developer/lightweight-update) | `ALTER TABLE [table] UPDATE` | Enable using `SET apply_mutations_on_fly = 1;`. Use when updating small amounts of data. Rows are immediately returned with updated data in all subsequent `SELECT` queries but are initially only internally marked as updated on disk. |
2826
| [ReplacingMergeTree](/en/engines/table-engines/mergetree-family/replacingmergetree) | `ENGINE = ReplacingMergeTree` | Use when updating large amounts of data. This table engine is optimized for data deduplication on merges. |
2927
| [CollapsingMergeTree](/en/engines/table-engines/mergetree-family/collapsingmergetree) | `ENGINE = CollapsingMergeTree(Sign)` | Use when updating individual rows frequently, or for scenarios where you need to maintain the latest state of objects that change over time. For example, tracking user activity or article stats. |
3028

3129
Here is a summary of the different ways to update data in ClickHouse:
3230

3331
## Update Mutations
3432

35-
Update mutations can be issued through a `ALTER TABLE … UPDATE` command e.g.
33+
Update mutations can be issued through a `ALTER TABLE … UPDATE` command e.g.
3634

3735
```sql
3836
ALTER TABLE posts_temp
@@ -44,9 +42,7 @@ Read more about [update mutations](/en/sql-reference/statements/alter/update).
4442

4543
## Lightweight Updates
4644

47-
<CloudAvailableBadge />
48-
49-
Lightweight updates provide a mechanism to update rows such that they are updated immediately, and subsequent `SELECT` queries will automatically return with the changed values (this incurs an overhead and will slow queries). This effectively addresses the atomicity limitation of normal mutations. We show an example below:
45+
Lightweight updates provide a mechanism to update rows such that they are updated immediately, and subsequent `SELECT` queries will automatically return with the changed values (this incurs an overhead and will slow queries). This effectively addresses the atomicity limitation of normal mutations. We show an example below:
5046

5147
```sql
5248
SET apply_mutations_on_fly = 1;
@@ -62,7 +58,7 @@ WHERE Id = 404346
6258
1 row in set. Elapsed: 0.115 sec. Processed 59.55 million rows, 238.25 MB (517.83 million rows/s., 2.07 GB/s.)
6359
Peak memory usage: 113.65 MiB.
6460

65-
-increment count
61+
-increment count
6662
ALTER TABLE posts
6763
(UPDATE ViewCount = ViewCount + 1 WHERE Id = 404346)
6864

@@ -84,11 +80,11 @@ Read more about [lightweight updates](/en/guides/developer/lightweight-update).
8480
## Collapsing Merge Tree
8581

8682
Stemming from the idea that updates are expensive but inserts can be leveraged to perform updates,
87-
the [`CollapsingMergeTree`](/en/engines/table-engines/mergetree-family/collapsingmergetree) table engine
83+
the [`CollapsingMergeTree`](/en/engines/table-engines/mergetree-family/collapsingmergetree) table engine
8884
can be used together with a `sign` column as a way to tell ClickHouse to update a specific row by collapsing (deleting)
89-
a pair of rows with sign `1` and `-1`.
90-
If `-1` is inserted for the `sign` column, the whole row will be deleted.
91-
If `1` is inserted for the `sign` column, ClickHouse will keep the row.
85+
a pair of rows with sign `1` and `-1`.
86+
If `-1` is inserted for the `sign` column, the whole row will be deleted.
87+
If `1` is inserted for the `sign` column, ClickHouse will keep the row.
9288
Rows to update are identified based on the sorting key used in the `ORDER BY ()` statement when creating the table.
9389

9490
```sql
@@ -120,7 +116,7 @@ HAVING sum(Sign) > 0
120116
```
121117

122118
:::note
123-
The approach above for updating requires users to maintain state client side.
119+
The approach above for updating requires users to maintain state client side.
124120
While this is most efficient from ClickHouse's perspective, it can be complex to work with at scale.
125121

126122
We recommend reading the documentation

0 commit comments

Comments
 (0)