Re: Performance after restart/reboot pre-Analyze

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: David Fogarty <dfogarty(at)icsusa(dot)com>
Cc: pgsql-novice(at)lists(dot)postgresql(dot)org
Subject: Re: Performance after restart/reboot pre-Analyze
Date: 2024-03-28 15:50:53
Message-ID: CAKFQuwZEcn9512o=Zgh_SsWnO0VcYU7-t4SZypJTY=AqtVwk9w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Thu, Mar 28, 2024 at 8:44 AM David Fogarty <dfogarty(at)icsusa(dot)com> wrote:

>
> It seems like whenever I restart my database server performance is quite
> bad until an Analyze has been performed. I expect this is due to the query
> planner needing new stats,
>

Nope, statistics are WAL logged.

> but that leads me to three questions:
>
> 1. Is there a way to have Analyze stats/query planner "plans" persist
> through a restart?
>

Plans are session-scoped.

What you are observing is the shared buffers being empty. There is a
contrib library, pg_prewarm, designed to help alleviate this problem.

https://www.postgresql.org/docs/current/pgprewarm.html

David J.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2024-03-28 15:52:59 Re: Performance after restart/reboot pre-Analyze
Previous Message David Fogarty 2024-03-28 15:43:37 Performance after restart/reboot pre-Analyze