MultiXact pessmization in 9.3 - Mailing list pgsql-hackers

From Andres Freund
Subject MultiXact pessmization in 9.3
Date
Msg-id 20131121200517.GM7240@alap2.anarazel.de
Whole thread Raw
Responses Re: MultiXact pessmization in 9.3
List pgsql-hackers
Hi,

While looking at the multixact truncation code (mail nearby), I've
noticed that there's a significant difference in the way multixact
members are accessed since fkey locks were introduced:

<9.3 when heap_lock_tuple finds a XMAX_IS_MULTI tuple it executes
MultiXactIdWait() which in turn uses GetMultiXactIdMembers() to get the
xids to wait for. But it skips the lookup if the mxid we lookup is older
than OldestVisibleMXactId.

9.3+ instead always looks up the members because GetMultiXactIdMembers()
is also used in cases where we need to access old xids (to check whether
members have commited in non-key updates). I've seen several profiles -
independent from this investigation - where GetMultiXactIdMembers() is
high up in the profiles. So this seems to be a significant
pessimization.
I think we need to re-introduce that optimization for the - hopefully
very common - case of LOCK_ONLY multixacts.

The file header's comment about OldestVisibleMXactId[] seems to be
out-of-date btw, since it's now perfectly normal to access mxids that
are older than what MultiXactIdSetOldestVisible() computed.

Maybe I am just missing something?

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Add \i option to bring in the specified file as a quoted literal
Next
From: Szymon Guz
Date:
Subject: Re: new unicode table border styles for psql