From: Noah Misch <noah@leadboat.com>
To: Andres Freund <andres@anarazel.de>
To: Andrey Borodin <x4mmm@yandex-team.ru>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Geoghegan <pg@bowt.ie>
Subject: Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data
Date: Tue, 7 Sep 2021 23:45:15 -0700
Message-ID: <20210908064515.GA2496820@rfd.leadboat.com> (raw)
In-Reply-To: <364BAA98-1A3F-4C39-B0D9-ED8C40EA902D@yandex-team.ru>
References: <20210807221957.GA169359@rfd.leadboat.com>
<5E041A70-4946-489C-9B6D-764DF627A92D@yandex-team.ru>
<20210808163752.GB23176@rfd.leadboat.com>
<20210814221328.GA146778@rfd.leadboat.com>
<20210815084535.GA1227376@rfd.leadboat.com>
<E86CBC3F-1FCF-44BF-BAD8-1301F66D8767@yandex-team.ru>
<20210815134547.3okuz6ktvu4qf7ig@alap3.anarazel.de>
<15936F8A-0436-40C8-9D1A-4A4623681554@yandex-team.ru>
<20210829180913.ghojzzsgkqgm7vki@alap3.anarazel.de>
<364BAA98-1A3F-4C39-B0D9-ED8C40EA902D@yandex-team.ru>
On Sun, Aug 29, 2021 at 11:38:03PM +0500, Andrey Borodin wrote:
> > 29 авг. 2021 г., в 23:09, Andres Freund <andres@anarazel.de> написал(а):
> >>> It seems like it's going to add a substantial amount of work even when
> >>> no 2PC xacts are involved?
> >> Only if 2PCs are enabled.
> >
> > I don't think that's good enough. Plenty of systems have 2PC enabled but very
> > few if any transactions end up as 2PC ones.
> Best optimisation I can imagine here is to gather all vxids with unknown xids and search for them in one call to TwoPhaseGetXidByVXid() with one LWLockAcquire(TwoPhaseStateLock, LW_SHARED).
>
> Does it worth the complexity?
https://www.postgresql.org/search/?m=1&q=TwoPhaseStateLock&l=&d=-1&s=r
suggests this is the first postgresql.org discussion of TwoPhaseStateLock as a
bottleneck. Nonetheless, if Andres Freund finds it's worth the complexity,
then I'm content with it. I'd certainly expect some performance benefit.
Andres, what do you think?
We could start with an unlocked scan of the twophase shared memory. If the
unlocked scan finds a potential match, acquire TwoPhaseStateLock and repeat
the scan. Otherwise, we don't need the locked scan, because we can deduce
that the locked scan would find nothing. I'm not fond of relying on such
reasoning without a known-strong performance need, but it's an alternative.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noah@leadboat.com, andres@anarazel.de, x4mmm@yandex-team.ru, pgsql-bugs@lists.postgresql.org, michael@paquier.xyz, tgl@sss.pgh.pa.us, pg@bowt.ie
Subject: Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data
In-Reply-To: <20210908064515.GA2496820@rfd.leadboat.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox