Reputation: 18269
I want to limit INSERTs to whichever transaction gets the lock (with the others waiting in line, not failing) while allowing concurrent reads, updates, and deletes (but obviously not of the data being inserted, which is impossible in PG anyway).
What is the lightest LOCK to achieve this?
Upvotes: 0
Views: 38
Reputation: 248125
Yes, if you want to lock a table against all concurrent modifications, SHARE ROW EXCLUSIVE
is the cheapest lock.
I'm not going to ask why you want to restrict concurrency in that way...
Upvotes: 1