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

Re: Seq scans status update

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Seq scans status update
Date: 2007-05-28 21:36:39
Message-ID: 10742.1180388199@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-patches
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?

One other question: I see the patch sets the threshold for switching
from normal to ring-buffer heapscans at table size = NBuffers.  Why
so high?  I'd have expected maybe at most NBuffers/4 or NBuffers/10.
If you don't want a seqscan blowing out your buffer cache, you surely
don't want it blowing out 90% of the cache either.

			regards, tom lane

In response to

Responses

pgsql-patches by date

Next:From: Gregory StarkDate: 2007-05-28 21:56:32
Subject: Re: Seq scans status update
Previous:From: Heikki LinnakangasDate: 2007-05-28 21:14:49
Subject: Re: Seq scans status update

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