Used optimized linear search in more code paths

Enterprise / PostgreSQL - Michael Paquier [paquier.xyz] - 22 September 2022 00:47 UTC

This commit updates two code paths to use pg_lfind32() introduced by b6ef167 with TransactionId arrays:- At the end of TransactionIdIsInProgress(), when checking for the case of still running but overflowed subxids.
- XidIsConcurrent(), when checking for a serializable conflict.

These cases are less impactful than 37a6e5d, but a bit of micro-benchmarking of this API shows that linear search speeds up by ~20% depending on the number of items involved (x86_64 and amd64 looked at here).

Author: Nathan Bossart

14ff44f80c Used optimized linear search in more code paths
src/backend/storage/ipc/procarray.c | 12 ++++--------
src/backend/storage/lmgr/predicate.c | 10 ++--------
2 files changed, 6 insertions(+), 16 deletions(-)

Upstream: git.postgresql.org


  • Share