All Questions
Postgresql medium

What is the recommended approach for performing an 'Upsert' (Insert or Update on conflict) in modern PostgreSQL versions?

  1. A REPLACE INTO: Replaces the existing record with the new values if a conflict is detected.
  2. B UPSERT SET: A dedicated keyword for atomic synchronization of single-row record updates.
  3. C INSERT ... ON CONFLICT DO UPDATE: The native Postgres syntax for conflict-aware writes.
  4. D SYNCHRONIZE TABLE: A bulk utility command for merging source and target data partitions.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions