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

From Sam Mason
Subject Re: clearing the buffer cache
Date
Msg-id 20090213181916.GJ32672@frubble.xen.chris-lamb.co.uk
Whole thread Raw
In response to Re: clearing the buffer cache  (Scott Ribe <scott_ribe@killerbytes.com>)
Responses Re: clearing the buffer cache  (Chris Mayfield <cmayfiel@cs.purdue.edu>)
List pgsql-general
On Fri, Feb 13, 2009 at 11:13:36AM -0700, Scott Ribe wrote:
> > I was hoping to run many thousands of small (i.e. 100ms or less) queries
> > and if it takes a couple of seconds to restart the database I'm not
> > going to be able to do this.
>
> Are you forgetting the OS's file system cache? That will also have a huge
> effect on performance, and so you'll need to clear it as well.

With recent versions of Linux you can flush the system's buffer cache by
doing:

  # echo 3 > /proc/sys/vm/drop_caches

This is pretty quick; I do this, wait a small amount of time just in
case and then start a new psql session.  I'm currently having to put a
restart of postgres before this flush as well which is slowing things
down a lot.

I'm not showing any statistically significant difference between the
first run and subsequent runs which would suggest that I'm either all
OK, or all wrong!

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

pgsql-general by date:

Previous
From: Scott Ribe
Date:
Subject: Re: clearing the buffer cache
Next
From: "Bob Pawley"
Date:
Subject: Re: Remote Connection