IT lexicon › Database › Upsert

Upsert

Database På svenska → Updated: 2026-05-23

"Update or insert" — if the row exists: update. If not: create.

Postgres: INSERT ... ON CONFLICT (id) DO UPDATE. MySQL: INSERT ... ON DUPLICATE KEY UPDATE. SQL Standard: MERGE. An atomic operation — avoids race conditions between a separate SELECT + INSERT/UPDATE.

← Back to the lexicon