Re: clearing the buffer cache - Mailing list pgsql-general

From Sam Mason
Subject Re: clearing the buffer cache
Date
Msg-id 20090216170016.GY32672@frubble.xen.chris-lamb.co.uk
Whole thread Raw
In response to Re: clearing the buffer cache  (Chris Mayfield <cmayfiel@cs.purdue.edu>)
Responses Re: clearing the buffer cache  (Greg Smith <gsmith@gregsmith.com>)
List pgsql-general
On Mon, Feb 16, 2009 at 11:09:59AM -0500, Chris Mayfield wrote:
> >With recent versions of Linux you can flush the system's buffer cache by
> >doing:
> >
> >  # echo 3 > /proc/sys/vm/drop_caches
>
> You can also try something like this:
> http://wiki.services.openoffice.org/wiki/Cold-start-simulator
>
> Shutting down the server and running fillmem has worked for me, but that
> might take too long in your situation of thousands of small queries.

Why is this better than asking the kernel to drop its caches?  The
kernel could reasonably assume that because you only touched the data in
a page once it could swap the "fillmem"s data out in preference to the
page cache.

Even if it did, you need to restart the server which is what prevents
testing going quickly in the first place.

> But I guess "SELECT * FROM large_table" would have taken just as long
> anyway.

This doesn't work on several levels any more; PG is smart enough to
recognize that this is what's happening and only uses a small buffer for
this (256KB at the moment).  Linux can be smart enough as well which is
why you need to ask it to drop the page cache.


--
  Sam  http://samason.me.uk/

pgsql-general by date:

Previous
From: Sam Mason
Date:
Subject: Re: ask: select right(column) ???
Next
From: Michal Politowski
Date:
Subject: Re: partial unique index and the planner