> On Tue, 2026-12-01 at 02:51 +0000, Greg Low wrote: > > > Surely the biggest issue there is the way that application work is > > > being done while holding any sort of lock. The transactions need to be > > > short and not waiting for any app work, particularly if it's heavy or > > > involved round trip latency. > > > > I agree. > > However, the world is not perfect, and sometimes a calculation takes longer > > than > > you would like. Also, what is long is relative: with a lot of contention, > > even a short transaction can run into a lot of conflicts. > > When we're developing database apps, we try to apply rules that say to never > hold any sort of explicit lock, apart from within a transaction, and never > spanning application execution or worse, user interaction. And we avoid ever > having any sort of network latency tied into that transaction as well.
That's commendable, but has little to do with what I wrote. All locks (other than advisory locks) live only within a single transaction. I am not talking about a user interaction inside a transaction, but some calculation within the application: read, calculate a new value, update. It is perfectly sensible to hold a lock on the row while you do that. Yours, Laurenz Albe
