pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Smith <greg@2ndquadrant.com>
To: Pierre C <lists@peufeu.com>
Cc: Nikolas Everett <nik9000@gmail.com>
Cc: Dave Crooke <dcrooke@gmail.com>
Cc: Paul McGarry <paul@paulmcgarry.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: shared_buffers advice
Date: Tue, 16 Mar 2010 16:51:49 -0400
Message-ID: <4B9FEF65.50005@2ndquadrant.com> (raw)
In-Reply-To: <op.u9nxzhryeorkce@localhost>
References: <a056b1d41003101728h2bfe964cg43bf5ef1aabae14d@mail.gmail.com>
	<ca24673e1003152217q117b0fd3q7d2d75ff20185c8b@mail.gmail.com>
	<4B9F3302.4020900@2ndquadrant.com>
	<op.u9nrbeeteorkce@localhost>
	<d4e11e981003160626o6c76d902t16073cabb4dadabc@mail.gmail.com>
	<op.u9nxzhryeorkce@localhost>

Pierre C wrote:
> Actually, I meant that in the case of a seq scan, PG will try to use 
> just a few buffers (a ring) in shared_buffers instead of thrashing the 
> whole buffers. But if there was actually a lot of free space in 
> shared_buffers, do the pages stay, or do they not ?

Pages inserted into the ring buffer and later re-used for new data do 
not stay behind even if there is room for them.  There's a potential 
improvement possible in that code involving better management of the 
situation where the buffer cache hasn't actually reached full capacity 
yet, but as it's an unusual case it's hard to justify optimizing for.  
Besides, the hope is that in this case the OS cache will end up caching 
everything anyway until it has a reason to evict it.  So if you follow 
the rest of the data suggesting you should not give all the memory to 
PostgreSQL to manage, you end up with a reasonable solution to this 
problem anyway.  Those pages will just live in the OS cache instead of 
the database's, with only a few trickling in and staying behind each 
time you do a sequential scan.

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




view thread (51+ messages)  latest in thread

Message-ID: <4B9FEF65.50005@2ndquadrant.com>
Permalink:  ../4B9FEF65.50005@2ndquadrant.com/
Also on:    postgresql.org/message-id/4B9FEF65.50005@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: greg@2ndquadrant.com, lists@peufeu.com, nik9000@gmail.com, dcrooke@gmail.com, paul@paulmcgarry.com
  Subject: Re: shared_buffers advice
  In-Reply-To: <4B9FEF65.50005@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox