0

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.

JourneyToJsDude
  • 155
  • 2
  • 11

2 Answers2

1

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.

Laurenz Albe
  • 167,868
  • 16
  • 137
  • 184
  • Cool. I was also wondering if in the case of multiple updates on the same transaction there would be a transaction level that would make it more performant. The official documentation does not help me with this question. Thanks! – JourneyToJsDude May 19 '22 at 09:49
0

Finally I have implemented the different transactions (insert, update) inside a procedure and released the locks with COMMIT after each transaction in order to avoid deadlocks, following this comment: https://stackoverflow.com/a/56768529

JourneyToJsDude
  • 155
  • 2
  • 11