this post was submitted on 26 Jun 2026
46 points (97.9% liked)

Programming

27447 readers
175 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 3 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] TehPers@beehaw.org 6 points 1 day ago (1 children)

I swear Postgres always has new features whenever I look at it again.

I was building a system for long running durable job queues with multiple workers and of course Postgres has a solution for that. You can do row-level locking in a transaction to "reserve" jobs for the duration of that transaction, and you can use SKIP LOCKED to skip over reserved jobs so workers don't block each other. There's also LISTEN and NOTIFY if you want pub/sub to track when jobs complete, for example.

[–] MonkderVierte@lemmy.zip 1 points 1 day ago (1 children)
[–] TehPers@beehaw.org 3 points 1 day ago

The row-level locking and SKIP LOCKED seem like appropriate features for a SQL-based DBMS. I find it odd that it's not more common, actually. Even MSSQL doesn't make any promises about locking just a row and might decide to lock a whole page instead, from what I read anyway.

NOTIFY/LISTEN might be scope creep though. I'm not really sure what led to it being implemented.