upsert

A database write that inserts a row if it does not exist and updates it if it does, in one statement.

In more detail

Because repeating the same upsert leaves the same result, it is naturally idempotent. It removes the need to check whether a row exists before writing.

Example

PostgreSQL: INSERT ... ON CONFLICT (event_id) DO UPDATE ...

Related terms

Taught in

References

Certification courses