~/talk

Sql table as a queue - what could go wrong?

Talkat 4Developers 2022 Online · 2022-04-04..04-07· [databases]
links:none on file
slides:none on file

Shows how to make a real SQL-backed queue: use an isolated table with columns id, headers, body and a rowversion for ordering, poll instead of unreliable DB notifications (example 200 ms poll trade-off), prefer SELECT using max/avg rowversion over COUNT for fast estimates, receive with a single transactional DELETE ... OUTPUT using UPDLOCK READPAST ORDER BY rowversion to avoid races, avoid clustered identity to prevent last-page latch contention—use a heap vs clustered index layout because typical messages (~1–2 KB message size) trigger page latch hot spots.

AI-written summary · about

  1. 0:00Start
  2. 8:22What makes a queue?
  3. 14:35Schema
  4. 19:27Inherent delay
  5. 29:05Minimizing contention
  6. 32:08PAGELATCH_EX Contention
  7. 42:12DTC is out. TransactionScope stays
~/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.