Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rps2U-009Avg-ED for pgsql-novice@arkaria.postgresql.org; Thu, 28 Mar 2024 15:51:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rps2T-00GSeX-Ei for pgsql-novice@arkaria.postgresql.org; Thu, 28 Mar 2024 15:51:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rps2T-00GSa2-4L for pgsql-novice@lists.postgresql.org; Thu, 28 Mar 2024 15:51:37 +0000 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rps2Q-0071Dq-0K for pgsql-novice@lists.postgresql.org; Thu, 28 Mar 2024 15:51:36 +0000 Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-6e704c49b3fso250649a34.2 for ; Thu, 28 Mar 2024 08:51:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711641092; x=1712245892; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=UX9V6P9nia2ffRfn0r1BNx8lUJA0ljs4UCPzADeRQpU=; b=eYgSaHOfifgZJjUQSYTqF2etHS8kW9zHjtOgxWYwlN1DuSHfI+cb0tTe6gt2VCOL3B VFqdUvvdGkISuXfkLgrgIQ458xzwgCCBNxtns0kmFG6vZ8Eys9+3cAxI8uThtTOAsTsB pufWME/DsGxyCNtrVlR0izmkhYxaZyhmZ2IUv0dY67kjMF0LxcS7+BWRxejPRCPkS05e VG9L91WeXr26k72yJNkczt+JszOjLhhKjtMbnfW6pFtFMefxOdQFOMZuuzehkC7FKLeD ibTDAFum/efF3v9jdaG0FWOOHZAL3Aj7RsxA+f5DMhrBPBiZdk0ywJAIjGSqY0Et5TKl yCVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711641092; x=1712245892; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UX9V6P9nia2ffRfn0r1BNx8lUJA0ljs4UCPzADeRQpU=; b=pASkOj5AXMDtBf34bcD+2nx5VbEU4OHy9KDIsoacANi/Pt8QyzmIm17PNIL/OR9NrK HUxQu2aTNQcc4OE29NKgNllZIgqNqTZPq0nxgzbd3uQEHmqyr6kW/Xgxjb6OT1igktN0 tb3RQiQhj5bpMp2aQ/juubQtfBe669vZwrAZjkuslzvlaQsyYJNlZ7pTvjV2En7OApoJ nje+CBo+WskjWrZv3/t5TvA6bTA7RYBAux4jnTnomYy2DymRP0KB2Dhukhfe9Nv9ckzW zevMedpmyCAysMHp+RJmS7gXBiMR847JbpTgNR23XfH+rvKAlorLXqYRJ37XZhAC2kTF j50Q== X-Gm-Message-State: AOJu0YyHOo0TO5qZBW+CzPztGkNlni7jW/5tYRy4An9pxKQOGakJ7r8Y ikPsswywWkZAqmHwS70MwFJujnk1Q9UczCk617uL45lZC/+7WyG0VkZgF2eBliyLbG8xbBlRRvf 6AdLsWsvflqxUyCnuK2Vpt4NfWxc= X-Google-Smtp-Source: AGHT+IEPH2cG81Kp1S+Gm3arokeMPUBuKQ3lO5ifZHl3+E6EJdnNpP0ShDrvv4ZG4l/fGurqbPp6RJuu+p05H4MaMr0= X-Received: by 2002:a05:6871:d20e:b0:229:f948:ab32 with SMTP id pk14-20020a056871d20e00b00229f948ab32mr3460957oac.57.1711641090588; Thu, 28 Mar 2024 08:51:30 -0700 (PDT) MIME-Version: 1.0 References: <6F39634B-20B1-4683-9320-C4D7B68D53CF@icsusa.com> In-Reply-To: <6F39634B-20B1-4683-9320-C4D7B68D53CF@icsusa.com> From: "David G. Johnston" Date: Thu, 28 Mar 2024 08:50:53 -0700 Message-ID: Subject: Re: Performance after restart/reboot pre-Analyze To: David Fogarty Cc: pgsql-novice@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000003007110614ba7f2d" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000003007110614ba7f2d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Mar 28, 2024 at 8:44=E2=80=AFAM David Fogarty = 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 quer= y > 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. --0000000000003007110614ba7f2d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Mar 28, 2024 at 8:44=E2=80=AFAM David Fogarty <= dfogarty@icsusa.com> wrote:

It seems like whenever I re= start 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 logge= d.
=C2=A0
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 observin= g is the shared buffers being empty.=C2=A0 There is a contrib library, pg_p= rewarm, designed to help alleviate=C2=A0this problem.

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

David J.

--0000000000003007110614ba7f2d--