Use a unique constraint on an idempotency key (or natural key) and upsert/insert-with-conflict-handling. If the same request arrives twice, the second write becomes a no-op or updates the same row instead of creating a duplicate.