On Fri, 2009-01-16 at 12:15 -0500, Tom Lane wrote:
> Simon Riggs <simon@2ndQuadrant.com> writes:
> > No need to wait for idle-in-transaction sessions during index builds.
> > GetCurrentVirtualXIDs() specifically *includes* backends that have
> > proc->xmin == InvalidTransactionId (0), but I'm not sure why.
>
> Because they might be about to change xmin to something real?
True, they might.
GetSnapshotData() involuntarily sets xmin in their proc, so they would
have to be doing some strange footwork: they would have to have started
GetSnapshotData() *before* the index build and not finished it until
*after* we check GetCurrentVirtualXIDs() (after the index build).
If you think that is a serious possibility, then grabbing ProcArrayLock
in exclusive mode should close that gap.
I can't see a reason for idle-in-transaction sessions to block index
builds.
-- Simon Riggs www.2ndQuadrant.comPostgreSQL Training, Services and Support