On Sun, 2010-04-25 at 12:43 -0400, Tom Lane wrote:
> Simon Riggs <simon(at)2ndQuadrant(dot)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
In response to
pgsql-hackers by date
|Next:||From: Simon Riggs||Date: 2010-04-25 17:00:58|
|Subject: Re: testing HS/SR - 1 vs 2 performance|
|Previous:||From: Tom Lane||Date: 2010-04-25 16:51:58|
|Subject: Re: testing HS/SR - 1 vs 2 performance |