4 ms·
FOR UPDATE NOWAIT immediately locks the rows being retrieved in the first step (as if they were to be updated) Technically "FOR UPDATE" only makes an attempt t
by bhahn 12y ago
FOR UPDATE NOWAIT immediately locks the rows being retrieved in the first step (as if they were to be updated)
Technically "FOR UPDATE" only makes an attempt to lock rows, and the "NOWAIT" instructs postgres, in the case that another transaction already has a lock on the row, to raise an error immediately instead of the default behavior of waiting for the lock to become available.
http://www.postgresql.org/docs/9.4/static/sql-select.html http://www.postgresql.org/docs/9.4/static/sql-select.html
- aanari 12y agoThat's a good clarification. I think it's better for the data migration to error out when acquiring the lock on rows and then retry, rather than waiting indefinitely, but YMMV (your mileage may vary).