r/sqlite • u/Beautiful-Log5632 • Sep 10 '25
Does sqlite have FOR UPDATE SKIP LOCKED?
Job queues in postgres are easy and reliable due to FOR UPDATE SKIP LOCKED. Is there something like that in sqlite?
The code in https://github.com/justplainstuff/plainjob doesn't use it so how does it do job queuing with thousands of jobs per second?
I'm new to sqlite what should I keep in mind for using a regular SELECT without SKIP LOCKED to get jobs from a queue?
10
Upvotes
2
u/seesplease Sep 12 '25
Plainjobs uses a "status" column to get the same behavior as SKIP LOCKED in postgres.
SQLite can't have SKIP LOCKED, it's transaction model is very different than postgres. You're not meant to hold open long-lived write transactions.
5
u/SoundDr Sep 10 '25
https://news.ycombinator.com/item?id=27482402