Re: clearing the buffer cache

Поиск
Список
Период
Сортировка
От Sam Mason
Тема Re: clearing the buffer cache
Дата
Msg-id 20090216170016.GY32672@frubble.xen.chris-lamb.co.uk
обсуждение исходный текст
Ответ на Re: clearing the buffer cache  (Chris Mayfield <cmayfiel@cs.purdue.edu>)
Ответы Re: clearing the buffer cache  (Greg Smith <gsmith@gregsmith.com>)
Список 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 по дате отправления:

Предыдущее
От: Sam Mason
Дата:
Сообщение: Re: ask: select right(column) ???
Следующее
От: Michal Politowski
Дата:
Сообщение: Re: partial unique index and the planner