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 1tqd9H-0083Qf-Rh for pgsql-hackers@arkaria.postgresql.org; Fri, 07 Mar 2025 19:14:19 +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 1tqd9F-00FMpk-8v for pgsql-hackers@arkaria.postgresql.org; Fri, 07 Mar 2025 19:14:17 +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 1tqd9E-00FMpc-Us for pgsql-hackers@lists.postgresql.org; Fri, 07 Mar 2025 19:14:16 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tqd9B-001YOf-12 for pgsql-hackers@lists.postgresql.org; Fri, 07 Mar 2025 19:14:16 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 527JE8H41116283; Fri, 7 Mar 2025 14:14:08 -0500 From: Tom Lane To: Jeff Davis cc: Ashutosh Bapat , Corey Huinker , Andres Freund , Michael Paquier , Nathan Bossart , Bruce Momjian , Matthias van de Meent , Magnus Hagander , Stephen Frost , Peter Smith , PostgreSQL Hackers , Alvaro Herrera , jian he Subject: Re: Statistics Import and Export: difference in statistics dumped In-reply-to: References: <97b451228227c555be1a4f79c4a62ddec9a74f06.camel@j-davis.com> <1457469.1740419458@sss.pgh.pa.us> <8d13e4296408c53a93390525d0bcb906cbd13df4.camel@j-davis.com> <768b2a237e892bf1334bdcbb066cdc1bd1368cb2.camel@j-davis.com> <5053263e41692dc2358a642403e9aa6fcda53578.camel@j-davis.com> Comments: In-reply-to Jeff Davis message dated "Wed, 05 Mar 2025 22:52:08 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1116281.1741374848.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 07 Mar 2025 14:14:08 -0500 Message-ID: <1116282.1741374848@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jeff Davis writes: > Sounds good. I will commit something like the v2 patch then soon, and > if we need a different condition we can change it later. Sadly, this made things worse not better: crake is failing cross-version-upgrade tests again [1], with dump diffs like @@ -270836,8 +270836,8 @@ -- SELECT * FROM pg_catalog.pg_restore_relation_stats( 'version', '000000'::= integer, 'relation', 'public.hash_f8_index'::regclass, - 'relpages', '66'::integer, - 'reltuples', '10000'::real, + 'relpages', '0'::integer, + 'reltuples', '-1'::real, 'relallvisible', '0'::integer ); I think what is happening is that the patch shut off CREATE INDEX's update of not only the table's stats but also the index's stats. This seems unhelpful: the index's empty stats can never be what's wanted. We could band-aid over this by making AdjustUpgrade.pm lobotomize the comparisons of all three stats fields, but I think it's just wrong as-is. Perhaps fix by checking the relation's relkind before applying the autovacuum heuristic? regards, tom lane [1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=3Dcrake&dt=3D2= 025-03-07%2018%3A19%3A14