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 1vBiXX-003tCg-P1 for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Oct 2025 23:46:47 +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 1vBiXW-0024a2-Nt for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Oct 2025 23:46:45 +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 1vBiXW-0024ZJ-1u for pgsql-hackers@lists.postgresql.org; Wed, 22 Oct 2025 23:46:45 +0000 Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1vBiXT-003FIn-15 for pgsql-hackers@lists.postgresql.org; Wed, 22 Oct 2025 23:46:44 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id 25A6B1D0013B; Wed, 22 Oct 2025 19:46:42 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Wed, 22 Oct 2025 19:46:42 -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=fm2; t=1761176802; x=1761263202; bh=YSGUxPQucQ HhXLit86jXv/w4pt6NYuv/lHrfZafRa2U=; b=WWKgacBUeDEynRCz9IlaLtmXVb ZnvCDXmsHeDWdj43Qyo1ciPhqFBRoP2XK7n/pSw4lEmdWgABJE1WzXeAmPsKSdJy WFaRWP/Y27jaivOTafpGacbdumlbuqE5sNna/1vRM9+DEOmNq+6tirvYVK8fWBJt D7QOAXKM8B3ozWJWV0hyZrS9wqz5JcwCe4Na/2h+g4LyjJGus5+W5YIxBqgObLM3 ENqpHMCKNYfQDuyNWzaendp5Q0S1sjySgUO68vhit4NNpSG19Iedq9NXri9mVytu SmIHP50PYNTQkL2CdOB7CrFYLmkhLi8/BNZQYIaRJESC5YR6nuAxKFzPnAXw== 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=fm2; t= 1761176802; x=1761263202; bh=YSGUxPQucQHhXLit86jXv/w4pt6NYuv/lHr fZafRa2U=; b=BWuZpaAolr1artyPWfxC64/xt0kW6qjSS1w2xqukUtjAjzfmY26 lOs7pnXQ1Q04LhG7wljFpQA5iBEvwBP12UuwAOyxOOvGlDrba4rLAe/8fYKErcAr HUJPXj910J5eNxCnZZ832/LfvM8dMYa7bo/GJzrzM4ml47e6lUKqOHeSQSCerkmh wSG5stWc60fG8ipJ4+Nm8gZDT2CrWK8sYBZZrnH3OoHLhNLw9bjVMHdDLC4Aio7s z3ba0Nk9C/2QIV4r21rNQ+PfhwZemXgOFrWh8yhWfEVlQwWV0IeSU4ItfyzckC6r 6hkFeKDfUNxyA4EYOTcZN7dFfFKWWR7ZvCw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddugeegleefucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeggeeg fffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidp nhgspghrtghpthhtohephedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheptghorh gvhidrhhhuihhnkhgvrhesghhmrghilhdrtghomhdprhgtphhtthhopehjihgrnhdruhhn ihhvvghrshgrlhhithihsehgmhgrihhlrdgtohhmpdhrtghpthhtohepthhomhgrshesvh honhgurhgrrdhmvgdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhs rdhpohhsthhgrhgvshhqlhdrohhrghdprhgtphhtthhopehtghhlsehsshhsrdhpghhhrd hprgdruhhs X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 22 Oct 2025 19:46:39 -0400 (EDT) Date: Thu, 23 Oct 2025 08:46:27 +0900 From: Michael Paquier To: Corey Huinker Cc: jian he , Tomas Vondra , pgsql-hackers@lists.postgresql.org, tgl@sss.pgh.pa.us Subject: Re: Extended Statistics set/restore/clear functions. Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="nrslA7d3CfuiW471" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --nrslA7d3CfuiW471 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 22, 2025 at 02:55:31PM +0300, Corey Huinker wrote: >> Do you have some numbers regarding the increase in size this generates >> for the catalogs? >=20 > Sorry, I don't understand. There shouldn't be any increase inside the > catalogs as the internal storage of the datatypes hasn't changed, so I can > only conclude that you're referring to something else. The new format meant more characters, perhaps I've just missed something while quickly testing the patch.. Anyway, that's OK at this stage. > The equivalent structures in attribute_stats.c will need documenting too. Right. This sounds like a separate patch to me, impacting HEAD. > Right now we have a situation where the vast majority of databases can > carry forward all of their stats via pg_upgrade, except for those databas= es > that have extended stats. The trouble is, most customers don't know if > their database uses extended statistics or not, and those that do are in > for some bad query plans if they haven't run vacuumdb --missing-stats-onl= y. > Explaining that to customers is complicated, especially when most of them > do not know what extended stats are, let alone whether they have them. It > would be a lot simpler to just say "all stats are carried over on upgrade= ", > and vacuumdb becomes unnecessary, making upgrades one step simpler as wel= l. Okay. > Given that, I think that the admittedly ugly transformation is worth it, > and sequestering it inside pg_dump is the smallest footprint it can have. > Earlier in this thread I posted some functions that did the translation > from the existing formats to the proposed new formats. We could include > those as new system functions, and that would make the dump code very > simple. Having said that, I don't know that there would be use for those > functions except inside pg_dump, hence the decision to do the transforms > right in the dump query. I'd prefer the new format. One killer pushing in favor of the new format that you are making upthread in favor of is that it makes much easier the viewing, editing and injecting of these stats. It's the part of the patch where we would need Tomas' input on the matter before deciding anything, I guess, as primary author of the original facilities. My view of the problem is just one opinion. > If the format translation is a barrier to fetching existing extended stat= s, > then I'd be more inclined to keep the existing pg_ndistinct and > pg_dependencies data formats as they are now. Not necessarily, it can be possible to also take that in multiple steps rather than a single one: - First do the basics in v19 with the new format. - Raise the bar to older versions. -- Michael --nrslA7d3CfuiW471 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmj5bNMACgkQnvQgOdby QH3pUQ//cabq0RhflF2GLZdeIGu/dM6RfccLpOCUD5pu9KB+3uwE+hsPGZIibE1m jLcMuFXnwMLYg02CEc+eL+THxv03Hfpk6ld3WxLUOxMkS8AadKG1YYnHX1vt7rcs pzINa9AikJnwRV9Rn+M1k1U6flzywWsGN5Gdl35uhsX7xOlzvbCwpfxkbdaiGHpR O5h56VmXtLzeVwETs8rCMjki4BMu9HGFWvrV1OVtNYbaBWAkNv8ihoBwBSM7/qtg LYsUQTQh90e2wc5HxFbuMJriHCffSpneZ1t17rp996Aacvl9J9PpAwF7N0uCGT5D pfKyYACZX9CbvurXkTO5ur3wLAfGNekRS8YTB4CphF3q62/06icRLB5NEc3uHRdJ UEXkEAmOalZWab7nE3t2H7sHF83mxTNyaTw5PorfTnnZ7Jj3uCygjsi/6o6sR/r0 uTZ7i8tUz7HgPlfh4XJXBpa6kaym0mje7xJjgmWyBLJ4FrlowaKB0Icad1UAe0Zq vD2to0rPX4pV5yaiwcUKfXtzQI6kKL2WIJbkOeHqETNShLcER2I1OOvLknrDDlf+ slEtmg0u6olKMYpFFUjstMZnGLfJj2Oyxvi7+nn1yhT1BW4C0cVE1xzL3+eq7VQQ vuKiiBmW/c0ZYfxTF+6zdAU0LtcEGGamv6OAZJiWlyrlR3IZECs= =xzEd -----END PGP SIGNATURE----- --nrslA7d3CfuiW471--