Skip to main content

Load-Based Updates for the Unique Model

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.

For these scenarios, the Doris Unique (primary key) model supports two load-based update methods: full-row update and partial column update. This document describes how to use both methods.

Full-row update

Loading into the Doris Unique model uses an Upsert mode: when new data is written, Doris automatically determines whether to "insert" or "update" based on the primary key.

ScenarioBehavior
Primary key does not existInsert a new data row
Primary key already existsOverwrite 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 documentation.

Partial column update

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 Column update document.