Skip to content

.tip

· one of the small things

synchronous_commit = off is fine for at-least-once work

Postgres waits for the WAL to reach disk before it calls a commit done. For business data, that wait is the whole point. For a queue whose consumers are idempotent anyway, it's the slowest step in the loop.

SET LOCAL synchronous_commit = off;

Set it per transaction on the worker, never globally. If the power dies the millisecond after a commit, the row comes back as pending and gets delivered again, which at-least-once already promised.

postgresqlperformance

Longer version: the post this came from.