Re: testing HS/SR - 1 vs 2 performance - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: testing HS/SR - 1 vs 2 performance
Date
Msg-id 1272214499.4161.1808.camel@ebony
Whole thread Raw
In response to Re: testing HS/SR - 1 vs 2 performance  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sun, 2010-04-25 at 12:43 -0400, Tom Lane wrote:
> Simon Riggs <simon@2ndQuadrant.com> writes:
> > [ v2 patch ]
> 
> BTW, while I'm looking at this, why bother with the separate
> KnownAssignedXidsValid[] array?  Wouldn't it be cheaper
> (certainly so in storage, probably so in access/update times)
> to have just the KnownAssignedXids[] array and store
> InvalidTransactionId in unused entries?

Well, that was exactly my first design.

Heikki came up with the additional array and I think it is an inspired
suggestion, because it allows the search() to use a simple binary
search. I attempted to write the binary-search-with-holes and it was
going to be very ugly code, so I went for another algorithm which was
also quite cool, but not as cool as Heikki's idea - which I was going to
give credit for.

The array adds 520*max_connections bytes of shared memory, but seems a
good tradeoff for the additional performance it allows. I guess we could
use a bit array, but that's slower to access. The bit array would be
9*max_connections bytes of shared memory, so a 40kB saving.

-- Simon Riggs           www.2ndQuadrant.com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: testing HS/SR - 1 vs 2 performance
Next
From: Simon Riggs
Date:
Subject: Re: testing HS/SR - 1 vs 2 performance