Re: [BackendXidGetPid] only access allProcs when xid matches - Mailing list pgsql-hackers

From Junwang Zhao
Subject Re: [BackendXidGetPid] only access allProcs when xid matches
Date
Msg-id CAEG8a3+aSwYJ1qWDhF83KXCqYgqQ567ENAzdmUsDOPCh=h-guw@mail.gmail.com
Whole thread Raw
In response to Re: [BackendXidGetPid] only access allProcs when xid matches  (Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>)
Responses Re: [BackendXidGetPid] only access allProcs when xid matches
List pgsql-hackers
On Wed, Aug 9, 2023 at 10:46 PM Ashutosh Bapat
<ashutosh.bapat.oss@gmail.com> wrote:
>
> On Wed, Aug 9, 2023 at 9:30 AM Junwang Zhao <zhjwpku@gmail.com> wrote:
> >
> > 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.
> >
>
> Looks good to me. However, I would just move the variable declaration
> with their assignments inside the if () rather than combing the
> expressions. It more readable that way.

yeah, make sense, also checked elsewhere using the original style,
attachment file
keep that style, thanks ;)

>
> --
> Best Wishes,
> Ashutosh Bapat



--
Regards
Junwang Zhao

Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Fix last unitialized memory warning
Next
From: Ashutosh Bapat
Date:
Subject: Re: Report planning memory in EXPLAIN ANALYZE