Re: Free Cache Memory (Linux) and Postgresql

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Denis Gasparin" <denis(at)edistar(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: Free Cache Memory (Linux) and Postgresql
Date: 2008-09-30 14:02:49
Message-ID: dcc563d10809300702x47b1ad6bj891cb2f45ebe8b3a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Sep 30, 2008 at 7:51 AM, Denis Gasparin <denis(at)edistar(dot)com> wrote:
> Tom Lane ha scritto:
>> Denis Gasparin <denis(at)edistar(dot)com> writes:
>>
>>> I'm evaluating to issue the drop_caches kernel command (echo 3 >
>>> /proc/sys/vm/drop_caches) in order to free unused pagecache, directory
>>> entries and inodes.
>>>
>>
>> Why in the world would you think that's a good idea?
>>
>> regards, tom lane
>>
>>
> We see cached memory growing on constant base, even if there are no
> connections to database.
>
> We have some tables that are truncated and reloaded with updated data on
> regular basis (3,4 days).
>
> It seems like postgres or the operating system (linux) is keeping in
> cache that old data even if it has been deleted.
>
> We're searching a way to free that memory without shutting down pgsql.

You're fixing a problem that isn't there. The OS allocates cache (the
cache shown under top). And it uses all free memory it can get its
hands on to do so. The second postgres or any other program asks for
memory, the kernel throws away the oldest bits of cache to provide
memory to the application.

What you are doing is counter-productive.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nikolas Everett 2008-09-30 14:03:26 Re: Free Cache Memory (Linux) and Postgresql
Previous Message Denis Gasparin 2008-09-30 13:51:44 Re: Free Cache Memory (Linux) and Postgresql