Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data - Mailing list pgsql-bugs

From Noah Misch
Subject Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data
Date
Msg-id 20210908064515.GA2496820@rfd.leadboat.com
Whole thread Raw
In response to Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data  (Andrey Borodin <x4mmm@yandex-team.ru>)
Responses Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data  (Noah Misch <noah@leadboat.com>)
List pgsql-bugs
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.



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17183: missing websearch_to_tsquery
Next
From: PG Bug reporting form
Date:
Subject: BUG #17184: When using openssl, the memory of a static variable is not freed in libpq