Home > Enterprise >  How to concurrently update PostgreSQL 13 table row without locks
How to concurrently update PostgreSQL 13 table row without locks

Time:05-20

I need to update a table with different measures per id and these updates will be run by different transactions.

I need to know if there is a way to unlock the row on the update statement as I do not need to read data at the moment and data consistency would not be a problem.

Thanks in advance.

CodePudding user response:

There is no way for two transactions to update the same row at the same time.

But that is not necessary. Just make sure that your database transactions are as short as possible, then no lock will be held for a long time. You can mode the update of that row towards the end of the transaction to reduce the time the lock is held.

  • Related