liveBook · Manning

Upsert

An upsert is a data-modification operation that updates a matching record or resource, or inserts it when no match exists.

How 4 Manning books explain it

Microservices Patterns, Second Edition

A database operation that inserts a record if it is absent and updates it otherwise.

How it is used
Handles uncertain record existence in CQRS view repositories when event handlers apply create or update events.
How deep it goes
Defines insert-if-absent and update-if-present behavior, and motivates it with out-of-order events; leaves concurrency and duplicate handling to further processing.
Examples
Uses create and update handlers encountering records already present or not yet created because related events arrive out of order.
What you can do after
Apply upserts in create and update methods to insert absent records or update existing ones.

Read how Microservices Patterns, Second Edition explains upsert →

Architecting an Apache Iceberg Lakehouse

An upsert operation inserts records that are absent and updates records that already exist according to a matching key or condition.

How it is used
Supports transactional ingestion, reconciliation, slowly changing dimensions, late-arriving data, and downstream synchronization.
How deep it goes
Explains matching, snapshot commits, engine responsibilities, and operational tradeoffs without detailing the Iceberg specification.
Examples
Uses a Spark MERGE between a staging table and target, matching records by identifier before updating or inserting.
What you can do after
Apply it via Apache Spark to reconcile staging data with Iceberg tables through conditional updates and inserts.

Read how Architecting an Apache Iceberg Lakehouse explains upsert →

ScyllaDB in Action

An upsert is a write operation that combines insert and update behavior by creating missing data or modifying existing data.

How it is used
Combines ScyllaDB inserts and updates into fast writes for restaurant-review rows.
How deep it goes
Explains syntax, partition-key filtering, preserved columns, and deferred deeper treatment of row liveness.
Examples
Uses an Ernie’s Eats fried-chicken review, UPDATE and INSERT statements, and a SELECT result.
What you can do after
Apply upserts with CQL UPDATE statements while preserving unchanged columns and targeting the partition key.

Read how ScyllaDB in Action explains upsert →

Akka in Action, Second Edition

An upsert is a database operation that inserts a record when no matching record exists and updates the matching record otherwise.

How it is used
Stores projected aggregates in a separate database while decoupling journal reads from writes.
How deep it goes
Defines insert-versus-update behavior and demonstrates transactional SQL, stopping short of database-library details.
Examples
Uses a cargo-per-container projection that creates a count and increments it for later CargoAdded events.
What you can do after
Apply it via ScalikeJDBC to create or update aggregate rows inside a projection transaction.

Read how Akka in Action, Second Edition explains upsert →

Also covered in

What to know first

Related concepts

Questions about upsert

What is upsert?

An upsert is a data-modification operation that updates a matching record or resource, or inserts it when no match exists.

Which Manning books explain upsert?

Microservices Patterns, Second Edition, Architecting an Apache Iceberg Lakehouse, ScyllaDB in Action and Akka in Action, Second Edition.

What should I know before learning upsert?

Manning books that teach upsert usually introduce topic and SQL first.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.