pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeff Davis <pgsql@j-davis.com>
Cc: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: Corey Huinker <corey.huinker@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Nathan Bossart <nathandbossart@gmail.com>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: Magnus Hagander <magnus@hagander.net>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: Peter Smith <smithpb2250@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: jian he <jian.universality@gmail.com>
Subject: Re: Statistics Import and Export: difference in statistics dumped
Date: Fri, 07 Mar 2025 14:14:08 -0500
Message-ID: <1116282.1741374848@sss.pgh.pa.us> (raw)
In-Reply-To: <c720ac7bf88721947faf87e174ed8e0d10c782eb.camel@j-davis.com>
References: <CADkLM=f0a43aTd88xW4xCFayEF25g-7hTrHX_WhV40HyocsUGg@mail.gmail.com>
	<97b451228227c555be1a4f79c4a62ddec9a74f06.camel@j-davis.com>
	<CADkLM=ckXu5wzSQZ3Y_fvAaL8rZ+upZdSecBLf5FCTMj7M6T-A@mail.gmail.com>
	<b227c4fca29dfb893bb414ce6d84fc2377489ecc.camel@j-davis.com>
	<CADkLM=dRMC6t8gp9GVf6y6E_r5EChQjMAAh_vPyih_zMiq0zvA@mail.gmail.com>
	<y2d36zf6pl3n6ni6e4ctblu3a5iazi2dycknq53h2mjvp7lto4@hhww3h2qgdrw>
	<1457469.1740419458@sss.pgh.pa.us>
	<CADkLM=eWSv2z_DVB=psfwHitq7DbFJQaP9A46R27eARC-4OYtQ@mail.gmail.com>
	<cpdanvzykcb5o64rmapkx6n5gjypoce3y52hff7ocxupgpbxu4@53jmlyvukijo>
	<CADkLM=dX67xer59tVYMCQZ+pHAT2sCyyrUDzeDCdW_TdxqwOgA@mail.gmail.com>
	<curtrasm6ylt7es2ukfuals2mh5an72yzxgvyel65mw3ere7qs@nw6m4ffpo4m3>
	<8d13e4296408c53a93390525d0bcb906cbd13df4.camel@j-davis.com>
	<CACJufxHG9MBQozbJQ4JRBcRbUO+t+sx4qLZX092rS_9b4SR_EA@mail.gmail.com>
	<CAExHW5vf9D+8-a5_BEX3y=2y_xY9hiCxV1=C+FnxDvfprWvkng@mail.gmail.com>
	<768b2a237e892bf1334bdcbb066cdc1bd1368cb2.camel@j-davis.com>
	<CAExHW5ttputnXg2! 31arxPWWScP7MkZjqRNjt4jPeht5GfypErw@mail.gmail.com>
	<5053263e41692dc2358a642403e9aa6fcda53578.camel@j-davis.com>
	<CAExHW5uL3++omHqoun2wMU0EUwb7R26F=SjCne6wZDGJzE3VOw@mail.gmail.com>
	<d6e08fde8cb173b34a96c7d2bc9985aa657ce51f.camel@j-davis.com>
	<CAExHW5sNgxkqkyscm9KRrcwvi+_Hg=PRe_u+xZYJzX+w4XAMjQ@mail.gmail.com>
	<ca81cbf6e6ea2af838df972801ad4da52640a503.camel@j-davis.com>
	<CAExHW5sEjLx-8r85+r=mL=o4jVx2Y0D-mRzGTZxcfNm4YSeRSQ@mail.gmail.com>
	<c720ac7bf88721947faf87e174ed8e0d10c782eb.camel@j-davis.com>

Jeff Davis <pgsql@j-davis.com> 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=crake&dt=2025-03-07%2018%3A19%3A14





view thread (22+ messages)  latest in thread

Message-ID: <1116282.1741374848@sss.pgh.pa.us>
Permalink:  ../1116282.1741374848@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1116282.1741374848@sss.pgh.pa.us

 · 

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: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql@j-davis.com, ashutosh.bapat.oss@gmail.com, corey.huinker@gmail.com, andres@anarazel.de, michael@paquier.xyz, nathandbossart@gmail.com, bruce@momjian.us, boekewurm+postgres@gmail.com, magnus@hagander.net, sfrost@snowman.net, smithpb2250@gmail.com, pgsql-hackers@lists.postgresql.org, alvherre@alvh.no-ip.org, jian.universality@gmail.com
  Subject: Re: Statistics Import and Export: difference in statistics dumped
  In-Reply-To: <1116282.1741374848@sss.pgh.pa.us>

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

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