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

From Ashutosh Bapat
Subject Re: Statistics Import and Export: difference in statistics dumped
Date
Msg-id CAExHW5uL3++omHqoun2wMU0EUwb7R26F=SjCne6wZDGJzE3VOw@mail.gmail.com
Whole thread Raw
In response to Re: Statistics Import and Export: difference in statistics dumped  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: Statistics Import and Export: difference in statistics dumped
List pgsql-hackers
On Sat, Mar 1, 2025 at 1:40 AM Jeff Davis <pgsql@j-davis.com> wrote:
>
> On Fri, 2025-02-28 at 14:51 +0530, Ashutosh Bapat wrote:
> > 2. We aren't restoring the statistics faithfully - as mentioned in
> > Greg's reply. If users dump and restore with autovacuum turned off,
> > they will be surprised to see the statistics to be different on the
> > original and restored database - which may have other effects like
> > change in plans.
>
> Then let's just address that concern directly: disable updating stats
> implicitly if autovacuum is off. If autovacuum is on, the user
> shouldn't have an expectation of stable stats anyway. Patch attached.

The fact that statistics gets updated is not documented at least under
CREATE INDEX page. So at least users should not rely on that
behaviour. But while we have hold of reltuples wasting a chance to
update it in pg_class does not look right to me. Changing regular
behaviour for the sake of pg_dump/pg_restore doesn't seem right to me.
I think the solution should be on the pg_dump/restore side and not on
the server side.

--
Best Wishes,
Ashutosh Bapat



pgsql-hackers by date:

Previous
From: Alena Rybakina
Date:
Subject: Re: Considering fractional paths in Append node
Next
From: Robert Haas
Date:
Subject: Re: making EXPLAIN extensible