[BackendXidGetPid] only access allProcs when xid matches

From: Junwang Zhao <zhjwpku(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [BackendXidGetPid] only access allProcs when xid matches
Date: 2023-08-09 04:00:34
Message-ID: CAEG8a3+i9gtqF65B+g_puVaCQuf0rZC-EMqMyEjGFJYOqUUWfA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In function `BackendXidGetPid`, when looping every proc's
TransactionId, there is no need to access its PGPROC since there
is shared memory access: `arrayP->pgprocnos[index]`.

Though the compiler can optimize this kind of inefficiency, I
believe we should ship with better code.

--
Regards
Junwang Zhao

Attachment Content-Type Size
0001-BackendXidGetPid-only-access-allProcs-when-xid-match.patch application/octet-stream 1.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2023-08-09 04:07:58 Re: pg15: reltuples stuck at -1 after pg_upgrade and VACUUM
Previous Message Rui Zhao 2023-08-09 03:47:58 Re: pg_upgrade fails with in-place tablespace