Search Postgresql Archives

Long living and expiring locks?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have multiple processes connecting to the same database. In order to
prevent race conditions the I would like the process to  issue a
SELECT FOR UPDATE  to lock the records that need to be processed.

The problem is that the locks are not inside of a single translation.
The process is multi step. Records are selected and presented to the
user, the user does some stuff and submits a form, the submitted form
updates those records and frees the lock.

Ideally I would do a select for update when the form is shown to the
user but with an expiry time so that if the user decides to move on
and not submit any changes the locks will expire.

I could do this with a locked_at field that I can update on select but
I would prefer to let postgres handle the locks if possible.





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux