Re: questions regarding shared_buffers behavior

From: Greg Smith <greg(at)2ndquadrant(dot)com>
To: Mark Rostron <mrostron(at)ql2(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: questions regarding shared_buffers behavior
Date: 2010-11-07 23:30:14
Message-ID: 4CD73686.4090807@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Mark Rostron wrote:
>
> What is the procedure that postgres uses to decide whether or not a
> table/index block will be left in the shared_buffers cache at the end
> of the operation?
>

There is no such procedure. When a table or index page is used, its
usage count goes up, which means it's more likely to stay in the cache
for longer afterwards. Processing trying to allocate pages are
constantly circling the buffer cache looking for pages where the usage
count is at 0 to re-use. The only special cases are for sequential
scans and VACUUM, which use continuously re-use a small section of the
buffer cache in some cases instead.

--
Greg Smith 2ndQuadrant US greg(at)2ndQuadrant(dot)com Baltimore, MD
PostgreSQL Training, Services and Support www.2ndQuadrant.us
"PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Greg Smith 2010-11-07 23:35:29 Re: Defaulting wal_sync_method to fdatasync on Linux for 9.1?
Previous Message Mark Rostron 2010-11-07 20:33:05 questions regarding shared_buffers behavior