logoalt Hacker News

diarrhea08/01/20253 repliesview on HN

This introduces long-running transactions, which at least in Postgres should be avoided.


Replies

danielheath08/01/2025

Depends what else you’re running on it; it’s a little expensive, but not prohibitively so.

show 1 reply
aitchnyu08/01/2025

I read too many "use Postgres as your queue (pgkitchensink is in beta)", now I'm learning listen/notify is a strain, and so are long transactions. Is there a happy medium?

show 1 reply
thewisenerd08/01/2025

t1: select for update where status=pending, set status=processing

t2: update, set status=completed|error

these are two independent, very short transactions? or am i misunderstanding something here?

--

edit:

i think i'm not seeing what the 'transaction at start of processor' logic is; i'm thinking more of a polling logic

    while true:
      r := select for update
      if r is None:
        return
      sleep a bit
this obviously has the drawback of knowing how long to sleep for; and tasks not getting "instantly" picked up, but eh, tradeoffs.
show 2 replies