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
Attachment:
signature.asc
Description: PGP signature