Skip to content
Advertisement

Tag: locking

waitlist in postgres, deadlock

I’m trying to create a waiting list in Postgres. Minimal code: status is important, because I want to be able to notify users when they are applied after waitlisted. But don’t want to notify them based on that they are in the first n position if they wasn’t waitlisted at all. Services are limited to a given number of users.

postgresql “idle in transaction” with all locks granted

A very simple delete (by key) on a small table (700 rows) every now and then stays “idle in transaction” for minutes (takes milliseconds usually) even though all the locks are marked as “granted”. What can I do to pinpoint what causes it? I’m using this select: which shows a lot of “RowExclusiveLock”s but all are granted… so I don’t

Update Query with select and row lock

I got this query as part of a previous answer to my question. Now how to lock the rows in the select query to make sure no other thread over writes my update. Answer It’s not clear to me that you have the problem you seem to think you have. Updating a row in the table inherently places a row-level

Only inserting a row if it’s not already there

I had always used something similar to the following to achieve it: …but once under load, a primary key violation occurred. This is the only statement which inserts into this table at all. So does this mean that the above statement is not atomic? The problem is that this is almost impossible to recreate at will. Perhaps I could change

Advertisement