Re: On the need for a snapshot in exec_bind_message()

From: Andres Freund <andres(at)anarazel(dot)de>
To: Daniel Wood <hexexpert(at)comcast(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: On the need for a snapshot in exec_bind_message()
Date: 2018-09-05 20:33:21
Message-ID: 20180905203321.6oinlusgj26npshr@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2018-09-05 12:31:04 -0700, Daniel Wood wrote:
> NOTE:
>
> In GetSnapshotData because pgxact, is declared volatile, the compiler will not reduce the following two IF tests into a single test:
>
>
> if (pgxact->vacuumFlags & PROC_IN_LOGICAL_DECODING)
> continue;
>
>
> if (pgxact->vacuumFlags & PROC_IN_VACUUM)
> continue;
>
>
> You can reduce the code path in the inner loop by coding this as:
>
> if (pgxact->vacuumFlags & (PROC_IN_LOGICAL_DECODING|PROC_IN_VACUUM))
> continue;
>
>
> I'm still working on quantifying any gain. Note it isn't just one L1 cache
>
> fetch and one conditional branch eliminated. Due to the update frequency of the pgxact cache line, for single statement TXN's, there are a certain number of full cache misses, due to invalidation, that occurs when given pgxact is updated between the first fetch of vacuumFlags and the 2nd fetch.

These two obviously could be combined, but I think we should just get
rid of the volatiles. With a small bit of work they shouldn't be
required anymore these days.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2018-09-05 20:54:54 Re: Bug in ginRedoRecompress that causes opaque data on page to be overrun
Previous Message Michael Paquier 2018-09-05 20:05:42 Re: pgsql: Clean up after TAP tests in oid2name and vacuumlo.