~/talk

How/Why to Sweep Async Tasks Under a Postgres Table

Talkat POSETTE: An Event for Postgres 2024 · 2024-06-11..06-13· [databases]
slides:none on file

Shows a concrete pattern: store tasks in a Postgres table and have a simple worker loop that runs a transaction, SELECT ... FOR UPDATE SKIP LOCKED a single row, do work, then DELETE ... RETURNING only after success so retries are automatic. Recommends order by random to avoid hot retry loops, using table sampling past a few hundred thousand rows, incrementing attempts inside the transaction, preferring identity over serial and JsonB or hstore for params.

AI-written summary · about

  1. 0:00The problem
  2. 2:23async tasks under a postgres table
  3. 3:18FOR UPDATE SKIP LOCKED
  4. 9:19Postgres vs Alternatives
  5. 10:48Implementing the worker
  6. 18:07Conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.