Update Data
Choose an update method based on your table model, write frequency, and whether each record contains a full row or only changed columns. For row-level updates, use a Unique Key table.
1. Choose the right update method
1.1 Compare table models and update capabilities
VeloDB Cloud provides three table models, with significant differences in support for updates and deletions. When making a selection, first confirm whether your business requires row-level updates or partial column updates.
| Table Model | Data Organization | Supported Update/Delete Methods | Typical Use Cases |
|---|---|---|---|
| Unique Key Model | Each row is identified by a unique primary key, deduplicated on write | UPSERT, partial column update, UPDATE, marked deletion, DELETE | Order status changes, user tag updates, CDC synchronization |
| Aggregate Key Model | Value columns with the same Key are merged by aggregation function (SUM/MAX/MIN/REPLACE) | Updated through ingestion based on aggregation semantics; DELETE only supports Key column conditions | Real-time reports, click counts, and other aggregation scenarios |
| Duplicate Key Model | Append-only writes, no deduplication or aggregation | Only supports DELETE | Logs, behavior tracking, and other append-only scenarios |
Choose a Unique Key table: Choose the Unique Key model when row-level updates or partial column updates are required.
1.2 Choose an update path
The Unique Key model supports two update paths, which can be chosen based on data scale and business frequency:
| Path | Applicable Scenarios | Recommended Write Method |
|---|---|---|
| Ingest-based update (UPSERT) | High-frequency, large-batch updates; CDC synchronization; multi-source wide table assembly | Stream Load, Routine Load, Broker Load, INSERT INTO |
DML update (UPDATE) | Low-frequency, batch updates; conditional data refresh; cross-table associated updates | UPDATE, INSERT INTO ... SELECT ... |
1.2.1 Update via ingestion (UPSERT)
All ingestion methods (Stream Load, Broker Load, Routine Load, INSERT INTO) process data in the Unique Key model with UPSERT semantics by default:
- If the primary key already exists: the old row is overwritten by the new row.
- If the primary key does not exist: a new row is inserted.

The behavior of ingest-based updates differs across table models. For details, see:
- Update Unique Key Tables through Loading: Implement full-row Upsert and partial column updates through Stream Load, Routine Load, and other methods.
- Update Aggregate Key Tables through Loading: The write semantics and available update methods for the Aggregate model.
1.2.2 Update via the UPDATE statement
VeloDB Cloud supports the standard SQL UPDATE, which can update data in Unique Key model tables based on WHERE conditions and supports cross-table associated updates.
-- Simple update
UPDATE user_profiles SET age = age + 1 WHERE user_id = 1;
-- Cross-table associated update
UPDATE sales_records t1
SET t1.user_name = t2.name
FROM user_profiles t2
WHERE t1.user_id = t2.user_id;
The execution process of UPDATE is: first scan the data that meets the conditions, then write the updated rows back. This is suitable for low-frequency, batch update scenarios.
Warning:
High-concurrency
UPDATEoperations on data with the same primary key are not recommended. ConcurrentUPDATEoperations cannot guarantee data isolation when they involve the same primary key.
For the syntax, typical usage, and limitations of the UPDATE statement, see: Update Data with UPDATE.
1.2.3 Update via INSERT INTO SELECT
Since the Unique Key model uses UPSERT semantics by default, using INSERT INTO ... SELECT ... can also achieve the effect of UPDATE, which is suitable for batch write-back from other tables.
1.3 Choose a deletion path
VeloDB Cloud provides two data deletion paths, with different implementation mechanisms across table models:
| Deletion Path | Supported Table Models | Description |
|---|---|---|
| Marked deletion via ingestion | Unique Key Model | Writes a __DORIS_DELETE_SIGN__ = 1 marker; background compaction later reclaims eligible obsolete versions |
DML deletion (DELETE / TRUNCATE) | All models | Delete data by condition or empty a table/partition |
For complete information, see Delete Data.
2. Understand Unique Key updates
2.1 Compare Merge-on-Write and Merge-on-Read
The Unique Key model has two data merging strategies. New Unique Key tables use Merge-on-Write by default unless you explicitly disable it. Existing Merge-on-Read tables keep their storage mode.
| Dimension | Merge-on-Write (MoW) | Merge-on-Read (MoR, legacy) |
|---|---|---|
| Behavior on write | Resolves duplicate keys on write and hides superseded versions from queries | Retains multiple versions on write |
| Query performance | Close to that of a Duplicate Key table without updates | Merges row versions during queries, adding query work |
| Write performance | Resolves versions during ingestion, adding write work | Close to a Duplicate Key table |
| Resource consumption | Writes and background Compaction consume more CPU/memory | Queries consume more CPU/memory |
| Applicable scenarios | Workloads that need efficient queries and partial column updates | Write-heavy with infrequent reads (no longer recommended) |
Use a Merge-on-Write Unique Key table for partial column updates.
2.2 Order updates with a Sequence column
In a distributed system, data may arrive out of order. For example, an order status changes successively to "Paid" and "Shipped", but due to network latency, the "Shipped" message may arrive at VeloDB Cloud before the "Paid" message.
The Sequence column mechanism solves this problem: when creating the table, specify a column (typically a timestamp or version number) as the Sequence column. When writing data with the same primary key, VeloDB Cloud always retains the row with the largest Sequence value.
CREATE TABLE order_status (
order_id BIGINT,
status_name STRING,
update_time DATETIME
)
UNIQUE KEY(order_id)
DISTRIBUTED BY HASH(order_id)
PROPERTIES (
"function_column.sequence_col" = "update_time" -- Specify update_time as the Sequence column
);
-- 1. Write the "Shipped" record (larger update_time)
-- {"order_id": 1001, "status_name": "Shipped", "update_time": "2023-10-26 12:00:00"}
-- 2. Write the "Paid" record (smaller update_time, arrives later)
-- {"order_id": 1001, "status_name": "Paid", "update_time": "2023-10-26 11:00:00"}
-- Final result: the record with the largest update_time is retained
-- order_id: 1001, status_name: "Shipped", update_time: "2023-10-26 12:00:00"
See Control Concurrent Updates for details about Sequence columns, row visibility, and concurrent UPDATE statements.
2.3 Delete rows with delete markers
__DORIS_DELETE_SIGN__ uses a "logical marker, background cleanup" approach, divided into three stages:
- Execute deletion: When data is deleted via ingestion or the
DELETEstatement, VeloDB Cloud does not immediately remove the data from physical files. The deletion is represented logically by a record with__DORIS_DELETE_SIGN__set to1; MoW also maintains delete bitmaps to hide superseded row versions. - Filter deleted rows from queries: During queries, ordinary queries hide deleted rows. The delete-sign predicate
__DORIS_DELETE_SIGN__ = 0describes which logical rows remain visible, together with MoW delete-bitmap filtering where applicable. - Reclaim obsolete versions through compaction: When the Compaction process detects that a primary key has both a normal record and a delete marker record, it can remove obsolete row versions when they are eligible for cleanup. Physical reclamation is asynchronous and depends on compaction and retained versions.

This diagram illustrates the delete-marker flow. Cleanup timing and query overhead depend on the workload and retained versions.
2.4 Update selected columns
Unique Key tables with MoW support partial column updates: during ingestion, you only need to provide the primary key and the columns to be updated. Columns that are not provided retain their original values.
How to enable:
| Ingestion Method | Configuration to Enable |
|---|---|
INSERT INTO | Set the session variable enable_unique_key_partial_update = true |
| Stream Load | Set the partial_columns HTTP header to true |
For fixed-column partial updates, keep MoW enabled:
CREATE TABLE user_profiles (
user_id BIGINT,
name STRING,
age INT,
last_login DATETIME
)
UNIQUE KEY(user_id)
DISTRIBUTED BY HASH(user_id)
PROPERTIES (
"enable_unique_key_merge_on_write" = "true"
);
-- Initial data
-- user_id: 1, name: 'Alice', age: 30, last_login: '2023-10-01 10:00:00'
-- Partial update via Stream Load, writing only age and last_login
-- {"user_id": 1, "age": 31, "last_login": "2023-10-26 18:00:00"}
-- Data after update
-- user_id: 1, name: 'Alice', age: 31, last_login: '2023-10-26 18:00:00'
In terms of implementation, partial column updates in the Unique Key model are not in-place updates. Instead, during ingestion, existing columns are read, missing fields are filled in, and the entire row is rewritten. This results in read amplification and write amplification: for example, when updating 10 fields of a 100-column wide table with similar field sizes, a simplified uncompressed model would read 9 MB of unchanged fields and write a 10 MB row for each 1 MB of changed fields. Actual I/O depends on caching, compression, and the table layout. This is an illustration, not a benchmark.
Performance recommendations:
| Recommendation | Description |
|---|---|
| Size the cluster for the workload | Partial column updates read existing values and can increase I/O. Batch writes and monitor the cluster during representative loads |
| Enable row store for wide tables | For very wide tables, enabling row store is recommended, so a single IO can read the entire row. In column store mode, each missing field requires a separate IO |
For complete usage instructions (Stream Load, INSERT INTO, Flink Connector, etc.), see: Update Selected Columns.
3. Apply updates to common workloads
3.1 Synchronize source changes with CDC
Tools such as Flink CDC capture the Binlog of upstream databases (MySQL, PostgreSQL, Oracle, etc.) and write it to VeloDB Cloud Unique Key model tables.

Key capabilities:
- Synchronize an entire database: Flink Doris Connector internally integrates Flink CDC, enabling end-to-end whole-database synchronization without manual table creation or field mapping.
- Handle change events: Configure these capabilities together with the connector's checkpoint and source-event ordering behavior:
- The Unique Key model UPSERT handles
INSERT/UPDATE. __DORIS_DELETE_SIGN__handlesDELETE.- A Sequence column with an ordering value that distinguishes source changes handles out-of-order data. Equal Sequence values do not define a deterministic event order.
- The Unique Key model UPSERT handles
3.2 Assemble wide tables from multiple sources
Using partial column updates, you can complete multi-source wide table assembly directly within VeloDB Cloud without performing real-time joins in Flink:
- Create a Unique Key model wide table.
- Different data sources (basic information, behavior logs, transaction data, etc.) write to it in real time via Stream Load / Routine Load.
- Each data stream writes only the columns it is responsible for, for example:
- The user behavior stream updates
page_view_countandlast_login_time. - The transaction stream updates
total_ordersandtotal_amount.
- The user behavior stream updates
Each stream sends only the columns it changes. The warehouse reads the missing values and rewrites the row. When independent streams share a key, coordinate event ordering in the source pipelines. A single Sequence column orders changes to the row as a whole.
4. Plan update workloads
4.1 Optimize update workloads
| No. | Recommendation | Description |
|---|---|---|
| 1 | Prefer ingest-based updates | For high-frequency, large-volume updates, prefer Stream Load and Routine Load over UPDATE DML |
| 2 | Batch writes | Each INSERT has transaction overhead. Batch small writes or consider Group Commit when its semantics fit your workload |
| 3 | Use high-frequency DELETE on Duplicate/Aggregate models with caution | Predicate accumulation affects subsequent query performance |
| 4 | Use TRUNCATE TABLE ... PARTITION to empty a partition | When deleting an entire partition, TRUNCATE TABLE ... PARTITION avoids row-by-row predicate deletion |
| 5 | Execute UPDATE serially | Avoid concurrent execution of UPDATE tasks that may operate on the same primary key |
4.2 Coordinate updates in shared storage
VeloDB Cloud separates compute from shared storage. MoW writes coordinate delete-bitmap updates through the Meta Service. Ingestion, compaction, and schema changes can contend for this metadata coordination.

To reduce contention:
- Batch writes: Combine small updates and control concurrent writers to the same table.
- Design partitions and buckets for the workload: Limit the partitions touched by each load and avoid excessive tablets. See partitioning and bucketing.
- Monitor update latency: If contention persists, contact VeloDB Cloud support. Compaction and service-level configuration are managed by VeloDB Cloud.
Update jobs consume cluster compute and can increase storage work. Test representative batches before scheduling large refreshes, and drop test tables when you no longer need them.