Re: pg_buffercache's usage count - Mailing list pgsql-general

From Greg Smith
Subject Re: pg_buffercache's usage count
Date
Msg-id 4B84E448.7010908@2ndquadrant.com
Whole thread Raw
In response to Re: pg_buffercache's usage count  (Ben Chobot <bench@silentmedia.com>)
Responses Re: pg_buffercache's usage count
List pgsql-general
Ben Chobot wrote:
> On Feb 23, 2010, at 3:06 PM, Ben Chobot wrote:
>
>
>> I'm looking at the usage count column of pg_buffercache's info, and I'm confused. Several buffers that supposed have
LRUvalues of 5 belong to non-unique indices which supposedly have never been used. As I understand things, that
shouldn'thappen. Am I missing something? 
>>
>
> (And maybe more to the point, when does the LRU go down in value?)
>

Usage counts only go up when a page is "pinned" because some backend
requested that particular block for its work via a call to BufferAlloc
with the file/block it needs.  Usage counts go down every time the clock
sweep hand looking to allocate new buffers passes over that page during
its constant circular scanning of the buffer cache.  The mechanics
involved are described in a pretty detailed way by the "Inside the
PostgreSQL Buffer Cache" presentation at
http://www.westnet.com/~gsmith/content/postgresql/ (and no where else
I'm aware of, besides the source code itself).

--
Greg Smith  2ndQuadrant US  Baltimore, MD
PostgreSQL Training, Services and Support
greg@2ndQuadrant.com   www.2ndQuadrant.us


pgsql-general by date:

Previous
From: Lew
Date:
Subject: Re: typecaste object to array
Next
From: "Albe Laurenz"
Date:
Subject: Re: Not able to change the owner of function