Optimize PredicateLockTuple().
authorThomas Munro <tmunro@postgresql.org>
Mon, 11 Nov 2019 03:34:01 +0000 (16:34 +1300)
committerThomas Munro <tmunro@postgresql.org>
Mon, 11 Nov 2019 04:06:59 +0000 (17:06 +1300)
commitdb2687d1f3787aa8113b3dbb358153feee30c64c
tree077c225c3a719ca4193038165ca152af97f6ac0c
parent695c5977c8bc115029a85dcc1821d7b0136b4e4c
Optimize PredicateLockTuple().

PredicateLockTuple() has a fast exit if tuple was written by the current
transaction, as in that case it already has a lock.  This check can be
performed using TransactionIdIsCurrentTransactionId() instead of
SubTransGetTopmostTransaction(), to avoid any chance of having to hit the
disk.

Author: Ashwin Agrawal, based on a suggestion from Andres Freund
Reviewed-by: Thomas Munro
Discussion: https://postgr.es/m/CALfoeiv0k3hkEb3Oqk%3DziWqtyk2Jys1UOK5hwRBNeANT_yX%2Bng%40mail.gmail.com
src/backend/storage/lmgr/predicate.c