Re: old synchronized scan patch - Mailing list pgsql-hackers

From Jim C. Nasby
Subject Re: old synchronized scan patch
Date
Msg-id 20061206184803.GM44124@nasby.net
Whole thread Raw
In response to Re: old synchronized scan patch  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: old synchronized scan patch  (Jeff Davis <pgsql@j-davis.com>)
List pgsql-hackers
On Tue, Dec 05, 2006 at 09:09:39AM -0800, Jeff Davis wrote:
> That being said, I can just lock the hint table (the shared memory hint
> table, not the relation) and only update the hint every K pages, as Niel
> Conway suggested when I first proposed it. If we find a K small enough
> so the feature is useful, but large enough that we're sure there won't
> be contention, this might be a good option. However, I don't know that
> we would eliminate the contention, because if K is a constant (rather
> than random), the backends would still all want to update that shared
> memory table at the same time.

What about some algorithm where only one backend will update the hint
entry (perhaps the first one, or the slowest one (ie: lowest page
number))? ISTM that would eliminate a lot of contention, and if you get
clever with the locking scheme you could probably allow other backends
to do non-blocking reads except when the page number passes a 4-byte
value (assuming 4-byte int updates are atomic).

Granted, coming up with a way to put one backend in charge of this is
non-trivial, but it's another option.
-- 
Jim Nasby                                            jim@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)


pgsql-hackers by date:

Previous
From: Teodor Sigaev
Date:
Subject: Re: [PATCHES] Bundle of patches
Next
From: "Jim C. Nasby"
Date:
Subject: Re: psql return codes