Update Unique Key Tables through Loading
In real-time data warehouse and operational database synchronization scenarios, users often face the following problems:
- Data in business tables needs to be continuously updated by primary key (such as order status changes or user profile refreshes), and writes should automatically determine whether to "insert" or "update".
- Only some fields change (for example, only updating an order's
status), and assembling the full record every time is undesirable.
Choose a full-row update when each incoming record contains the complete row. Choose a partial column update when the record contains only changed fields. Partial updates require a Merge-on-Write Unique Key table.
Replace or insert full rows
Loading into the VeloDB Cloud Unique model uses an Upsert mode: when new data is written, VeloDB Cloud automatically determines whether to "insert" or "update" based on the primary key.
| Scenario | Behavior |
|---|---|
| Primary key does not exist | Insert a new data row |
| Primary key already exists | Overwrite the existing data row with the new data |
Supported load methods include:
- Stream Load
- Broker Load
- Routine Load
INSERT INTO
A full-row update is identical to loading a new record. For detailed usage, see the data loading overview documentation.
Update selected columns
When only some fields need to be updated, you can use the partial column update capability of the Unique model to avoid assembling the full record. For detailed information (including usage examples, flexible partial column updates, and handling of new rows), see the Update columns in Unique Key tables document.