Optimizing GetConflictingVirtualXIDs()

Started by Simon Riggsabout 16 years ago4 messageshackers
Jump to latest
#1Simon Riggs
simon@2ndQuadrant.com

Optimize GetConflictingVirtualXIDs() in roughly the same manner we
optimize TransactionIdIsInProgress().

Views?

--
Simon Riggs www.2ndQuadrant.com

Attachments:

optimize_get_conflicts.patchtext/x-patch; charset=UTF-8; name=optimize_get_conflicts.patchDownload+35-9
#2Bruce Momjian
bruce@momjian.us
In reply to: Simon Riggs (#1)
Re: Optimizing GetConflictingVirtualXIDs()

On Sun, Feb 14, 2010 at 2:59 PM, Simon Riggs <simon@2ndquadrant.com> wrote:

Optimize GetConflictingVirtualXIDs() in roughly the same manner we
optimize TransactionIdIsInProgress().

Views?

EINSUFFICIENTEXPLANATION :)

--
greg

#3Simon Riggs
simon@2ndQuadrant.com
In reply to: Bruce Momjian (#2)
Re: Optimizing GetConflictingVirtualXIDs()

On Sun, 2010-02-14 at 17:06 +0000, Greg Stark wrote:

On Sun, Feb 14, 2010 at 2:59 PM, Simon Riggs <simon@2ndquadrant.com> wrote:

Optimize GetConflictingVirtualXIDs() in roughly the same manner we
optimize TransactionIdIsInProgress().

Views?

EINSUFFICIENTEXPLANATION :)

...I like that error code.

The patch adds a calculation of RecentGlobalXmin each time it accesses
the proc array to derive conflicts. It then uses the derived value to
provide a fast-path out if a potential snapshot conflict arrives that we
already know will not conflict with any backends. The purpose of this is
to reduce the number of scans of the procarray and improve the
performance of the startup process.

The mechanism and purpose is the same as the first check in
TransactionIdIsInProgress().

--
Simon Riggs www.2ndQuadrant.com

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Simon Riggs (#3)
Re: Optimizing GetConflictingVirtualXIDs()

Simon Riggs <simon@2ndQuadrant.com> writes:

On Sun, 2010-02-14 at 17:06 +0000, Greg Stark wrote:

EINSUFFICIENTEXPLANATION :)

...I like that error code.

I think more EINSUFFICIENTCOMMENTS. The patch should also add a comment
to the function, along the lines of "While we have the lock, also update
RecentGlobalXmin, so that we will have as up-to-date a value as possible
for next time". You've also failed to document the meaning or purpose
of the added output parameter.

regards, tom lane