> > Why can't we keep all locks until main tx end ?
> 
> For committed subtransactions we have to do that, yes, but for aborted
> subtransactions we must release.  Otherwise you can't implement a retry
> loop around a potentially-deadlocking operation.

Ok, that would certainly be good to have, but it is imho not a "must have".

> > (I am assuming that a deadlock will still break the whole tx)
> 
> Wrong.  We might as well not bother with the entire project.

There are plenty of examples that do not involve deadlocks.
The most prominent was plobably "insert -> duplicate key -> update instead"
Also the new NOLOCK statements come to mind, ...

Andreas

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to