Re: Optimizing GetConflictingVirtualXIDs()

Lists: pgsql-hackers
From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Optimizing GetConflictingVirtualXIDs()
Date: 2010-02-14 14:59:22
Message-ID: 1266159562.7341.9201.camel@ebony
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


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

Views?

--
Simon Riggs www.2ndQuadrant.com

Attachment Content-Type Size
optimize_get_conflicts.patch text/x-patch 4.5 KB

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Optimizing GetConflictingVirtualXIDs()
Date: 2010-02-14 17:06:09
Message-ID: 407d949e1002140906q4abe6238rb1fd97bddfd7cff8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Feb 14, 2010 at 2:59 PM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
> Optimize GetConflictingVirtualXIDs() in roughly the same manner we
> optimize TransactionIdIsInProgress().
>
> Views?

EINSUFFICIENTEXPLANATION :)

--
greg


From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Optimizing GetConflictingVirtualXIDs()
Date: 2010-02-14 17:39:28
Message-ID: 1266169168.7341.9433.camel@ebony
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, 2010-02-14 at 17:06 +0000, Greg Stark wrote:
> On Sun, Feb 14, 2010 at 2:59 PM, Simon Riggs <simon(at)2ndquadrant(dot)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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Optimizing GetConflictingVirtualXIDs()
Date: 2010-02-14 17:45:50
Message-ID: 22777.1266169550@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Simon Riggs <simon(at)2ndQuadrant(dot)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