On 5/11/17 17:28, Andres Freund wrote:
> Isn't that pretty much the point? The whole open_share_lock()
> optimization looks like it really only can make a difference with
> subtransactions?
Yeah that confused me too. That keep-the-lock-for-the-whole-transaction
logic was introduced in a2597ef17958e75e7ba26507dc407249cc9e7134 around
7.3, way before subtransactions (8.0). The point there was apparently
just to avoid hitting the lock manager on subsequent calls. That code
has since been moved around end refactored many times. When
subtransactions were introduced, the current logic of keeping the lock
across subtransactions was added in order to keep the original intent.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services