Re: pg_buffercache's usage count

From: Greg Smith <greg(at)2ndquadrant(dot)com>
To: Ben Chobot <bench(at)silentmedia(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_buffercache's usage count
Date: 2010-02-24 08:33:12
Message-ID: 4B84E448.7010908@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 LRU values of 5 belong to non-unique indices which supposedly have never been used. As I understand things, that shouldn't happen. 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(at)2ndQuadrant(dot)com www.2ndQuadrant.us

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2010-02-24 08:51:00 Re: Not able to change the owner of function
Previous Message Iñigo Martinez Lasala 2010-02-24 08:31:54 Re: how do I do dump and restore without bugging with constraint?