synchronous_commit = off is fine for at-least-once work
Postgres waits for the WAL to hit disk before it calls a commit done. For business data that wait is the point. For a queue whose consumers are idempotent anyway, it is the slowest thing in the loop.
SET LOCAL synchronous_commit = off;Set it per transaction on the worker, never globally. If power dies in 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.