Re: Statistics Import and Export: difference in statistics dumped - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Statistics Import and Export: difference in statistics dumped
Date
Msg-id 1116282.1741374848@sss.pgh.pa.us
Whole thread Raw
In response to Re: Statistics Import and Export: difference in statistics dumped  (Jeff Davis <pgsql@j-davis.com>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Álvaro Herrera
Date:
Subject: Re: Simplify the logic a bit (src/bin/scripts/reindexdb.c)
Next
From: Ranier Vilela
Date:
Subject: Re: Simplify the logic a bit (src/bin/scripts/reindexdb.c)