From: | Greg Smith <gsmith(at)gregsmith(dot)com> |
---|---|
To: | Sam Mason <sam(at)samason(dot)me(dot)uk> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: clearing the buffer cache |
Date: | 2009-02-15 02:49:43 |
Message-ID: | Pine.GSO.4.64.0902142136520.13196@westnet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, 13 Feb 2009, Sam Mason wrote:
> I was hoping for a function I could call, or maybe some variable I write
> to, that would cause the contents to be invalidated.
For most people, just restarting the server is acceptable overhead, which
is why nobody has bothered to write such a thing. It wouldn't be too
difficult for someone familiar with the basic internals involved to hack
in such a function, getting it accepted into the standard distribution
would be quite another problem though.
As you noticed, just "select * from t" where t is a dummy table doesn't
help here anymore. What you could do is write a quick PL/pgSQL function
that simulates that in a way that isn't optimized away. Create a table
that's bigger than shared_buffers with a primary key, then iterate over
that table record at a time using that key until you've scanned records to
wipe out the cache. You can use contrib/pg_buffercache to confirm the
function is doing what you expect.
--
* Greg Smith gsmith(at)gregsmith(dot)com http://www.gregsmith.com Baltimore, MD
From | Date | Subject | |
---|---|---|---|
Next Message | Fernando Moreno | 2009-02-15 05:05:32 | Re: Array in nested query |
Previous Message | John R Pierce | 2009-02-15 01:00:02 | Re: pg_hba reload |