Re: clearing the buffer cache

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: clearing the buffer cache
Date: 2009-02-13 18:19:16
Message-ID: 20090213181916.GJ32672@frubble.xen.chris-lamb.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bob Pawley 2009-02-13 18:24:22 Re: Remote Connection
Previous Message Scott Ribe 2009-02-13 18:13:36 Re: clearing the buffer cache