Re: PG 9.2 slave restarted - cache not impacted

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Lucas Possamai <drum(dot)lucas(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: PG 9.2 slave restarted - cache not impacted
Date: 2020-10-23 03:19:59
Message-ID: 20201023031959.GB5180@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Oct 23, 2020 at 11:23:20AM +1300, Lucas Possamai wrote:
> I'm a bit confused about PG cache.
>
> I have a PostgreSQL 9.2 cluster (yes, we're planning on upgrading it to 12)
> with a master and a slave database.
>
> The application is sending all read requests to the slave, where the master
> processes the writes.
>
> A while ago we had to restart the master database server, and the
> application was slow for a couple of days while PG cache was warmed up.
> Yesterday, we had to restart the slave database server and we did not have
> the same problem.
>
> I would like to understand why?

Perhaps you misunderstood the effects of the OS cache and the Postgres
shared buffers? On restart the cluster discards the shared buffers
internal to Postgres. It does not mean that the OS cache is changed,
and it matters a lot in terms of performance. By the way, if you want
to warm up your caches faster, an option you can consider with 9.2
(which is a version not officially supported by the community by the
way so please upgrade) would be to use pgfincore.
--
Michael

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Philip Semanchuk 2020-10-23 13:01:03 Re: postgres materialized view refresh performance
Previous Message Lucas Possamai 2020-10-22 22:23:20 PG 9.2 slave restarted - cache not impacted