pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
how to clean the cache from databases and operating system
3+ messages / 2 participants
[nested] [flat]

* how to clean the cache from databases and operating system
@ 2018-09-26 06:25  jimmy <mpokky@126.com>
  0 siblings, 1 reply; 3+ messages in thread

From: jimmy @ 2018-09-26 06:25 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

1、When I execute the firse sql query, like below:
     select * from tablename;
     there are some datas that will be loaded into the database cache.
     How to clean the data from cache.
2、When I execute second sql query like below:
     SELECT pg_prewarm('tablename', 'buffer') . Data will be loaded into the  database cache.
     How to clean the data from cache.
3、When I execute the third sql query like below:
     SELECT pg_prewarm('tablename', 'main') . Data will be loaded into the  os  cache.
     How to clean the data from cache.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: how to clean the cache from databases and operating system
@ 2018-09-26 14:52  Maxence Ahlouche <maxence.ahlouche@gmail.com>
  parent: jimmy <mpokky@126.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Maxence Ahlouche @ 2018-09-26 14:52 UTC (permalink / raw)
  To: jimmy <mpokky@126.com>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>; Julien Rouhaud <rjuju123@gmail.com>

Hi,

On 26 September 2018 at 08:25, jimmy <mpokky@126.com> wrote:

> 1、When I execute the firse sql query, like below:
>      select * from tablename;
>      there are some datas that will be loaded into the database cache.
>      How to clean the data from cache.
> 2、When I execute second sql query like below:
>      SELECT pg_prewarm('tablename', 'buffer') . Data will be loaded into
> the  database cache.
>      How to clean the data from cache.
> 3、When I execute the third sql query like below:
>      SELECT pg_prewarm('tablename', 'main') . Data will be loaded into the
>  os  cache.
>      How to clean the data from cache.
>

To drop the system cache, as per [0] : echo 3 > /proc/sys/vm/drop_caches
To drop postgres' cache, afaik the easiest is to restart postgres.

If you're like me and too lazy to do all that (and don't care about
potentially losing data), you can also install an extension rjuju and I
wrote that allows you to do that simply with `SELECT pg_drop_caches`.
See [1] for the extension and [2] for how to use it.

[0] https://www.kernel.org/doc/Documentation/sysctl/vm.txt search for
"drop_caches" in that page
[1] https://github.com/rjuju/pg_dropbuffers
[2] https://maahl.net/pg_dropbuffers



>
>
>
>

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re:Re: how to clean the cache from databases and operating system
@ 2018-09-27 01:10  jimmy <mpokky@126.com>
  parent: Maxence Ahlouche <maxence.ahlouche@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: jimmy @ 2018-09-27 01:10 UTC (permalink / raw)
  To: Maxence Ahlouche <maxence.ahlouche@gmail.com>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>; Julien Rouhaud <rjuju123@gmail.com>

I use windows server 2012 R2.
How to drop postgresql's data in the system cache.
In windows server 2012 R2, I restart postgresql by restarting postgresql service,  wether it can drop postgres' cache?






At 2018-09-26 22:52:08, "Maxence Ahlouche" <maxence.ahlouche@gmail.com> wrote:

Hi,



On 26 September 2018 at 08:25, jimmy <mpokky@126.com> wrote:

1、When I execute the firse sql query, like below:
     select * from tablename;
     there are some datas that will be loaded into the database cache.
     How to clean the data from cache.
2、When I execute second sql query like below:
     SELECT pg_prewarm('tablename', 'buffer') . Data will be loaded into the  database cache.
     How to clean the data from cache.
3、When I execute the third sql query like below:
     SELECT pg_prewarm('tablename', 'main') . Data will be loaded into the  os  cache.
     How to clean the data from cache.


To drop the system cache, as per [0] : echo 3 > /proc/sys/vm/drop_caches
To drop postgres' cache, afaik the easiest is to restart postgres.


If you're like me and too lazy to do all that (and don't care about potentially losing data), you can also install an extension rjuju and I wrote that allows you to do that simply with `SELECT pg_drop_caches`.
See [1] for the extension and [2] for how to use it.



[0] https://www.kernel.org/doc/Documentation/sysctl/vm.txt search for "drop_caches" in that page

[1] https://github.com/rjuju/pg_dropbuffers

[2] https://maahl.net/pg_dropbuffers











 




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2018-09-27 01:10 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-09-26 06:25 how to clean the cache from databases and operating system jimmy <mpokky@126.com>
2018-09-26 14:52 ` Maxence Ahlouche <maxence.ahlouche@gmail.com>
2018-09-27 01:10   ` jimmy <mpokky@126.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox