Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] Can we Flush the Postgres Shared Memory ?

From: tv(at)fuzzy(dot)cz
To: "raghu ram" <raghuchennuru(at)gmail(dot)com>
Cc: "Raghavendra" <raghavendra(dot)rao(at)enterprisedb(dot)com>, "Simon Riggs" <simon(at)2ndquadrant(dot)com>, "pgsql-admin" <pgsql-admin(at)postgresql(dot)org>, "pgsql-general" <pgsql-general(at)postgresql(dot)org>, "pgsql novice" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: [GENERAL] Can we Flush the Postgres Shared Memory ?
Date: 2011-05-03 13:53:27
Message-ID: 6a9c2326b29433bde0de5c8a887d65be.squirrel@sq.gransy.com (view raw or flat)
Thread:
Lists: pgsql-adminpgsql-generalpgsql-novice
> On Tue, May 3, 2011 at 6:01 PM, Raghavendra <
> raghavendra(dot)rao(at)enterprisedb(dot)com> wrote:
>
>>
>> On Tue, May 3, 2011 at 5:37 PM, Simon Riggs <simon(at)2ndquadrant(dot)com>
>> wrote:
>>
>>> On Tue, May 3, 2011 at 11:54 AM, raghu ram <raghuchennuru(at)gmail(dot)com>
>>> wrote:
>>>
>>> > It may be a silly question, still out of curiosity I want to know, is
>>> there
>>> > any possible way to flush the Postgres Shared Memory without
>>> restarting
>>> the
>>> > cluster.
>>> > In Oracle, we can flush the SGA, can we get the same feature here..
>>> > Thanks in Advance.
>>>
>>>
>>> The CHECKPOINT command will do this for you.
>>>
>>
>>
>>
> According to PostgreSQL documentation, whenever you execute "CHECKPOINT"
> in
> the database,it will flush the modified data files presented in the Shared
> Buffers retuned to the Disk.
>
>            http://www.postgresql.org/docs/9.0/static/sql-checkpoint.html
>
> Is this clears the entire shared memory cache and same time,if i execute
> fresh SQL statement, Data will be retuned from disk??

No. Checkpoint means all dirty buffers are written to the datafiles, it
does not mean emptying the shared buffers. Checkpoints happen regularly so
this would have an unwanted impact on performance.

And besides that, there's a page cache maintained by the OS (not sure if
you're running Linux or Windows). So even when the block does not exist in
the shared buffers, it may be in the page cache (thus not read from the
drive).

Dropping the page cache is quite simple (http://linux-mm.org/Drop_Caches),
emptying the shared buffers is not that simple - I guess the easiest way
is to restart the db.

What are you trying to achieve? Why do you need this?

Tomas


In response to

pgsql-novice by date

Next:From: Simon RiggsDate: 2011-05-03 13:54:30
Subject: Re: Can we Flush the Postgres Shared Memory ?
Previous:From: Merlin MoncureDate: 2011-05-03 13:51:07
Subject: Re: [GENERAL] Can we Flush the Postgres Shared Memory ?

pgsql-admin by date

Next:From: Simon RiggsDate: 2011-05-03 13:54:30
Subject: Re: Can we Flush the Postgres Shared Memory ?
Previous:From: Merlin MoncureDate: 2011-05-03 13:51:07
Subject: Re: [GENERAL] Can we Flush the Postgres Shared Memory ?

pgsql-general by date

Next:From: Simon RiggsDate: 2011-05-03 13:54:30
Subject: Re: Can we Flush the Postgres Shared Memory ?
Previous:From: Merlin MoncureDate: 2011-05-03 13:51:07
Subject: Re: [GENERAL] Can we Flush the Postgres Shared Memory ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group