Skip site navigation (1) Skip section navigation (2)

Re: Seq scans status update

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Seq scans status update
Date: 2007-05-30 00:43:19
Message-ID: 1180485799.26915.102.camel@dogma.v10.wvs (view raw or flat)
Thread:
Lists: pgsql-patches
On Mon, 2007-05-28 at 17:36 -0400, Tom Lane wrote:
> Heikki Linnakangas <heikki(at)enterprisedb(dot)com> writes:
> > One idea is to keep track which pins are taken using the bulk strategy. 
> > It's a bit tricky when a buffer is pinned multiple times since we don't 
> > know which ReleaseBuffer corresponds which ReadBuffer, but perhaps we 
> > could get away with just a flag per pinned buffer. Set the flag when a 
> > buffer is pinned with bulk strategy and it wasn't pinned by us before, 
> > and clear it when it's pinned with another strategy. I'm thinking we 
> > steal one bit from PrivateRefCount for this.
> 
> Seems like a mess.  Why don't we just fix it so there's no need for
> different behavior at Unpin time?  The facts on the ground are that
> the current patch's change in UnpinBuffer is a no-op anyway, because
> of the tupletableslot interference.
> 
> The behavior I'm imagining is just that when we try to take a buffer
> from the ring, if its usage count exceeds 1 then drop it from the ring
> and get another buffer.  1 would be the expected case if no one had
> touched it since we last used it.
> 
> >> A heapscan would pin the buffer only once and hence bump its count at
> >> most once, so I don't see a big problem here.  Also, I'd argue that
> >> buffers that had a positive usage_count shouldn't get sucked into the
> >> ring to begin with.
> 
> > True, except that with the synchronized scans patch two synchronized 
> > scans will pin the buffer twice.
> 
> Hmm.  But we probably don't want the same buffer in two different
> backends' rings, either.  You *sure* the sync-scan patch has no
> interaction with this one?
> 

I will run some tests again tonight, I think the interaction needs more
testing than I did originally. Also, I'm not sure that the hardware I
have is sufficient to test those cases.

It looks like the case to worry about is when there are a large number
of scans on the same table and the I/O system is fast enough that it
causes lock contention on the buffers in the rings. Is this the case
you're worried about?

Also, keep in mind that I have added a SyncScanLock after I ran those
tests. That could have an effect.

Regards,
	Jeff Davis



In response to

Responses

pgsql-patches by date

Next:From: Greg SmithDate: 2007-05-30 03:35:23
Subject: Re: WIP: 2nd-generation buffer ring patch
Previous:From: Tom LaneDate: 2007-05-29 23:02:05
Subject: Re: Regression tests

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group