UPSERT does exactly what it says it does:

  • If a record is missing it INSERTs it
  • Otherwise it UPDATEs it

This means keeping data current is idempotent - less code is needed so there are less opportunities to make mistakes.