On Mon, 2007-05-28 at 17:36 -0400, Tom Lane wrote: > Heikki Linnakangas <[EMAIL PROTECTED]> 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 ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings