Optimize memory access in GetRunningTransactionData()
authorAlexander Korotkov <akorotkov@postgresql.org>
Wed, 3 Jul 2024 23:05:37 +0000 (02:05 +0300)
committerAlexander Korotkov <akorotkov@postgresql.org>
Wed, 3 Jul 2024 23:05:37 +0000 (02:05 +0300)
commit6897f0ec024582a570868939d3f34a6853374723
tree8c9d63f70635cc43061f7b3e4ab8dcad9ee48ec2
parent6c1af5482e6943a5f29b7f4ca773c720ec8202b0
Optimize memory access in GetRunningTransactionData()

e85662df44 made GetRunningTransactionData() calculate the oldest running
transaction id within the current database.  This commit optimized this
calculation by performing a cheap transaction id comparison before fetching
the process database id, while the latter could cause extra cache misses.

Reported-by: Noah Misch
Discussion: https://postgr.es/m/20240630231816.bf.nmisch%40google.com
src/backend/storage/ipc/procarray.c