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: Corey Huinker <corey.huinker@gmail.com>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: Peter Smith <smithpb2250@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Tomas Vondra <tomas.vondra@enterprisedb.com>
Subject: Re: Statistics Import and Export
Date: Mon, 01 Apr 2024 13:18:46 -0400
Message-ID: <1097772.1711991926@sss.pgh.pa.us> (raw )
In-Reply-To: <57e2d0c87d30e9b0dfb80f5b5d6a1a82a2539f10.camel@j-davis.com >
References: <Zei1xMGH8SJS9yoc@tamriel.snowman.net >
<54f190b6c757da2a33cce811949e9dd9601fcba7.camel@j-davis.com >
<1632327b74a734f8c434eb75e824160d2b06a697.camel@j-davis.com >
<CADkLM=dOUfTtpmE70mx5SmdEs11hic61G-wPa45pB1iC3NRABg@mail.gmail.com >
<16412b8b7ae443cb7470006beff3011927048860.camel@j-davis.com >
<CADkLM=cq1n2wbxhV23pOeUKReBPZxZyELDsDJ3VAxkYBSVAe0g@mail.gmail.com >
<CADkLM=d_WYoFq75eoNHso+9EFDi=Q2BtCmxQYMjrgLL4=v5dxw@mail.gmail.com >
<1b1bd1ec39ab3de09a17bf7b241021067e5bd63c.camel@j-davis.com >
<CADkLM=eJXPQD=pWwwm+4Y48haiMmznB8dCECNMrwr59niY8ESw@mail.gmail.com >
<2bce855db8259c5672a09f863a307ca07b967b68.camel@j-davis.com >
<CADkLM=dw=fkvPRmOw74UDYnLzXwkDyMSY1k2jsU5=xXBAj7Mpw@mail.gmail.com >
<5e94c358caedf2a231dd71624c3578db7227a265.camel@j-davis.com >
<CADkLM=dztWa9shWHyq=+rS9KvbZQ2v54tnOcYT+g8psf0B7w_A@mail.gmail.com >
<CADkLM=fFwkd7VbO4SPCyX-2f-fyGraka5J+5fcp1QMrCefu68Q@mail.gmail.com >
<CADkLM=cioQmOFh98qQmqVEkVPjLYszEhZtNtUbmmNAdHOSr3WQ@mail.gmail.com >
<4afa70edab849ff1623! ! 8d1100b6652404e9a4d9d.camel@j-davis.com >
<CADkLM=e=_6dtacmrvd2NJWacOnQ3Zu5iaRZFgePL1=0L5-7P_w@mail.gmail.com >
<3df03aa65aa6ea3a76582e1a792e422dc5c32ad3.camel@j-davis.com >
<CAOuzzgpfm9hROr_g8LouvpOeqv4yxk3qXPXU9Sn2nnqzPpP5UA@mail.gmail.com >
<718fa933c2c58d0ecc61995ab5c7ca1fe78d6369.camel@j-davis.com >
<CAOuzzgqwxpq=3aNF_j5rvYmb71BHY4niZfpeJZFa-QLyLA1GFg@mail.gmail.com >
<e16cd9caf4f5229a152d318d70b4d323a03e3539.camel@j-davis.com >
<CADkLM=c8hAew1CdUBQNWr3r0dkZCu9DNhXV-X7ccLDNiQKhAnA@mail.gmail.com >
<c3bc9b9eab819d9c6077b29588fca333ee2cbd80.camel@j-davis.com >
<447200.1711819134@sss.pgh.pa.us >
<cea2d432215847a1d5cef1422ad1b21814f3f73b.camel@j-davis.com >
<473884.1711820380@sss.pgh.pa.us >
<CADkLM=eRY=SaaLb0AtX-TZEog-jAdsm-k8D5PqXnFanxUbov1w@mail.gmail.com >
<581538.1711843736@sss.pgh.pa.us >
<57e2d0c87d30e9b0dfb80f5b5d6a1a82a2539f10.camel@j-davis.com >
Jeff Davis <pgsql@j-davis.com> writes:
> On Sat, 2024-03-30 at 20:08 -0400, Tom Lane wrote:
>> I haven't looked at the details, but I'm really a bit surprised
>> by Jeff's assertion that CREATE INDEX destroys statistics on the
>> base table. That seems wrong from here, and maybe something we
>> could have it not do. (I do realize that it recalculates reltuples
>> and relpages, but so what? If it updates those, the results should
>> be perfectly accurate.)
> In the v15 of the patch I was looking at, "pg_dump -s" included the
> statistics. The stats appeared first in the dump, followed by the
> CREATE INDEX commands. The latter overwrote the relpages/reltuples set
> by the former.
> While zeros are the right answers for a schema-only dump, it defeated
> the purpose of including relpages/reltuples stats in the dump, and
> caused the pg_upgrade TAP test to fail.
> You're right that there are a number of ways this could be resolved --
> I don't think it's an inherent problem.
I'm inclined to call it not a problem at all. While I do agree there
are use-cases for injecting false statistics with these functions,
I do not think that pg_dump has to cater to such use-cases.
In any case, I remain of the opinion that stats are data and should
not be included in a -s dump (with some sort of exception for
pg_upgrade). If the data has been loaded, then a subsequent
overwrite by CREATE INDEX should not be a problem.
regards, tom lane
view thread (543+ messages) latest in thread
Message-ID: <1097772.1711991926@sss.pgh.pa.us>
Permalink: ../1097772.1711991926@sss.pgh.pa.us/
Also on: postgresql.org/message-id/1097772.1711991926@sss.pgh.pa.us
copy link · copy postgr.es
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, corey.huinker@gmail.com, sfrost@snowman.net, ashutosh.bapat.oss@gmail.com, boekewurm+postgres@gmail.com, smithpb2250@gmail.com, pgsql-hackers@lists.postgresql.org, tomas.vondra@enterprisedb.com
Subject: Re: Statistics Import and Export
In-Reply-To: <1097772.1711991926@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