STEP 9 OF 10 · CONDITIONAL WRITE
Or let the row say whether it is done
When the effect is a state change on one row, a conditional write works without a separate table: UPDATE orders SET status = 'charged' WHERE id = 42 AND status = 'pending', with the debit in the same transaction.
The first run changes one row. The retry changes zero rows, sees that, and skips the debit. Same outcome as the dedupe record: the retry is a no-op.
Why it matters. A state machine on the row is often the simplest idempotency key you already have. Pick whichever matches where the effect lives.