How to Upsert in Redshift

Last updated July 25, 2026 · By the SaturnSQL team

Redshift now supports MERGE for insert-or-update in one statement. On older patterns, load new rows into a staging table, DELETE matching rows from the target, and INSERT the staging rows, all in one transaction.

MERGE

MERGE INTO customers
USING customers_staging s
ON customers.id = s.id
WHEN MATCHED THEN UPDATE SET email = s.email, updated_at = s.updated_at
WHEN NOT MATCHED THEN INSERT VALUES (s.id, s.email, s.updated_at);

Classic staging-table pattern

BEGIN;
DELETE FROM customers
USING customers_staging s
WHERE customers.id = s.id;
INSERT INTO customers SELECT * FROM customers_staging;
COMMIT;

There is no ON CONFLICT in Redshift, and unique constraints are not enforced, so the upsert logic has to guarantee uniqueness itself. The staging pattern is still the fastest option for large batches.

Run this in SaturnSQL

SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.

Try it free

Related Redshift guides

© 2026 Panda Capital Oy Ab. All rights reserved.