public inbox for [email protected]  
help / color / mirror / Atom feed
From: David G. Johnston <[email protected]>
To: David Fogarty <[email protected]>
Cc: [email protected]
Subject: Re: Performance after restart/reboot pre-Analyze
Date: Thu, 28 Mar 2024 08:50:53 -0700
Message-ID: <CAKFQuwZEcn9512o=Zgh_SsWnO0VcYU7-t4SZypJTY=AqtVwk9w@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On Thu, Mar 28, 2024 at 8:44 AM David Fogarty <[email protected]> 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.


view thread (4+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Performance after restart/reboot pre-Analyze
  In-Reply-To: <CAKFQuwZEcn9512o=Zgh_SsWnO0VcYU7-t4SZypJTY=AqtVwk9w@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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