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 1uyPQi-007eXE-6R for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Sep 2025 06:44:44 +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 1uyPQf-00FjtJ-Fb for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Sep 2025 06:44:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uyPQf-00FjtA-63 for pgsql-hackers@lists.postgresql.org; Tue, 16 Sep 2025 06:44:41 +0000 Received: from fout-b1-smtp.messagingengine.com ([202.12.124.144]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1uyPQd-000fzm-2o for pgsql-hackers@lists.postgresql.org; Tue, 16 Sep 2025 06:44:41 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id 130E31D001B7; Tue, 16 Sep 2025 02:44:39 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Tue, 16 Sep 2025 02:44:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1758005078; x=1758091478; bh=OboZU6Vflf HFPV9Tz1lws2CkWXlCg9NzPK1vvbTkS4U=; b=uL/mNPeaeBvLozFrmXgwhvEygz URdFbJuwyzIw8NQMto/uJ42QzqA3+VVRTFsXXHTbgaktvagAG1bs/tTCrrA7rmzg nmd3Utwn9UPgQqsyP3LWdsUwB3N9jL7GyzF83dl6gU0rtMchXn8fPzT//HoLU0nz RxHVbpbRiyjmEkOpxURmxLA45f6tAvsx7Bg07WECrFsCa0LTP8HJ9yJJ7Xxi09wn O8hdLOQGAsz6bSNbehJ00GemzL6ArwLg27d/pcGg8d4GEeOgD5XIF8HgKU/F31Zu WJhDZ7tvOXEMCptBcNyTP9w9QVPj50OAvDAqmFvxn3zBJ4q71Wj4cMDbLsfg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1758005078; x=1758091478; bh=OboZU6VflfHFPV9Tz1lws2CkWXlCg9NzPK1 vvbTkS4U=; b=NrxFRqGQENCXYdMyB2Lh2XLivNz35dHcLqfJgsNhAq9ruFQkylc +sj9CfwTQ8QePtyOkoqqiQ+EbzalzTiJBZwnIYtOcXV5obp5RyrWNzgZL4s0wfUN c5ELXigy/4KNLFvN7dsIoay3el+YbqZXluVfzRRsRhosDeKxYtneeDfc3UqpWTKq rafk3gI131B6DayQ2W1XGoJZZiMbBoLnWSvbxGboZBZNNBwRXrNvY7oZmfN3j0Vt Ip0CiQWCCGnOU65uBu/elcQMhTFbqkkx1noqK7eH5yxdTcGcjDkogSN4ojcN9XuC a3gGgqislHVG1zMDxCxXGeDDtJ04vfN65cA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdefleekjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlh cuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvden ucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprghquh hivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetleeifedufffhhfdtteelgeeggeff hfekueevteeigfduudevudetgfegiedvjeenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiiipdhn sggprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehrvghshh hkvghkihhrihhllhesghhmrghilhdrtghomhdprhgtphhtthhopegsvghrthhrrghnuggu rhhouhhvohhtrdhpghesghhmrghilhdrtghomhdprhgtphhtthhopehrohgsvghrthhmhh grrghssehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrshes lhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 16 Sep 2025 02:44:37 -0400 (EDT) Date: Tue, 16 Sep 2025 15:44:25 +0900 From: Michael Paquier To: Kirill Reshke Cc: Bertrand Drouvot , Robert Haas , pgsql-hackers@lists.postgresql.org Subject: Re: relfilenode statistics Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="vnrT+5yAGHMoTbKl" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --vnrT+5yAGHMoTbKl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 13, 2025 at 02:00:52PM +0500, Kirill Reshke wrote: > Hmm. While it is true that catalog lookups cannot be performed during > crash recovery, is it really necessary to save and retrieve statistics > after a crash? Yes, losing stats on crash is a *very* annoying thing. Having no stats for a relation means that autovacuum gives up entirely on relations it has no stats of, skipping it entirely until they have rebuilt and bloat would accumulate. Being able to recover these stats=20 =66rom crash recovery is a cheap design, that would improve reliability by a large degree. > Given that statistics are permitted to be outdated and > server crashes are anticipated to be infrequent, it looks loke losing > a few analysis runs due to server crashes is acceptable. > In any case, I am totally OK with the relfilenode-based method because > it is generally less restricted (to other postgresql parts e.g. wal- > replay ) and simpler. The startup process is not connected to a database and has no access to pg_class: the only thing we can know about are the on-disk files, not their in-catalog OIDs. FWIW, I think that this patch would be a huge step forward a more reliable stats system. True that the patch needs a rebase. Bertrand has also mentioned that some points needed more work. -- Michael --vnrT+5yAGHMoTbKl Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmjJB0kACgkQnvQgOdby QH2W/w//bY94yWeEtRsPhdq7IsT2TsqWW14df3G6a76Ma/Ck0GgGAov9Z8tikcbZ IhQNa6FlfpbIIZpX3ohOpRG+7b6Fa56bicPc7mqsnYfejwuQKRf0od/FHe0Exw7W BMXkrOW7XJJPj08AjCqBUKsHCwwfW67/rAxMqlfm4FT5bJrV0Uk7V1ZRC0OpsxtN hx0iI0W8sGk6xv5uEnQFfIuwbcZLOKFZL7/bHMvCMtzEnq8ngogg+Oiwt2gmK1Hb b2FH4IiUw+pCkgtZj3RbTlGO+WkepZ+jXIaOrIyv81552vVxc9GhB63Bn4nHEuQg yRXcA63EpEvvg7NNOsNRKOzVSy6ZiaWhsXe8WsVZLSVAAHvCUubWzjKsFBrjv0TK TQS0IWBLfuYdyvTdR/KXo2hJPx+RE/2/Sc2Of7Fw4YWRO7je9S+l/C5/hWqhWjXi Jd4dGT/amTJSYNX1dvwR+o7Skgrb0ACbnqLeS5wUGhoBbo6j1W3+/am21Oq+ahmT 1jZSrO+o6ulGSnbNu6cKV/MCFn+te33tyZ+/j8jmUc0724nn4omBqzuZ/8Y3m5QD TE9tHozBbs2HQYT8qccqGHuDRuuTn9JMo8g8zUWjQTSDdrS3itXPcTlTFrm/xhk8 qYBK72OcyfEslwHvGZjhOvagWWfgXx7UIPQG7efumslW3rHmMTc= =Zptb -----END PGP SIGNATURE----- --vnrT+5yAGHMoTbKl--