Greg Smith <gsmith@gregsmith.com> writes:
> Based on my observations of buffer cache statistics, the number of pinned
> buffers at any time is small enough that in a reasonably sized buffer
> cache, I wouldn't expect a change in the pinned usage_count behavior to
> have any serious impact.
Fair enough. The patch I put up earlier tonight bumps usage_count at
PinBuffer instead of UnpinBuffer time, and leaves the clock sweep
behavior unchanged, which means that a buffer that had stayed pinned for
more than a clock-sweep cycle time could get recycled almost instantly
after being unpinned. That seems intuitively bad. If we make the clock
sweep code not decrement usage_count of a pinned buffer then the problem
goes away. I had expressed some discomfort with that idea, but I've got
to admit that it's only a vague worry not anything concrete. Barring
objections I'll adjust the patch to include the clock-sweep change.
regards, tom lane