N
N
Nikolai Markov2015-04-01 13:10:56
PostgreSQL
Nikolai Markov, 2015-04-01 13:10:56

How can you already implement skip locked in Postgres?

The new postgres will have a feature - skip locked, which skips locked rows in the table. A very useful feature for implementing queues. I wonder how you can already get a similar functionality. I myself am now implementing this at the language level. I store the state column and pull out one record at a time and try to lock them (by changing the state) through select for update. But this solution has downsides.
UPD: I need to make a persistent queue for executing pending tasks.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2015-04-01
@manameiz

www.postgresql.org/docs/9.4/static/explicit-lockin...
www.postgresql.org/docs/9.4/static/functions-admin...
pg_try_advisory_xact_lock
indexcan (by order by ) and filter after where pg_try_advisory_xact_lock(myID )
dklab.ru/chicken/nablas/53.html here you have to look

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question