Re: Statistics Import and Export

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Magnus Hagander <magnus(at)hagander(dot)net>, Jeff Davis <pgsql(at)j-davis(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Subject: Re: Statistics Import and Export
Date: 2024-04-05 04:18:50
Message-ID: CAExHW5sGJhQqBY6THguZd8LAEPGj4jmQyu4rCep+UKyw0mz+cg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Apr 5, 2024 at 7:00 AM Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
wrote:

> For a partitioned table this value has to be true. For a normal table when
>> setting this value to true, it should at least make sure that the table has
>> at least one child. Otherwise it should throw an error. Blindly accepting
>> the given value may render the statistics unusable. Prologue of the
>> function needs to be updated accordingly.
>>
>
> I can see rejecting non-inherited stats for a partitioned table. The
> reverse, however, isn't true, because a table may end up being inherited by
> another, so those statistics may be legit. Having said that, a great deal
> of the data validation I was doing was seen as unnecessary, so I' not sure
> where this check would fall on that line. It's a trivial check if we do add
> it.
>

I read that discussion, and it may be ok for pg_upgrade/pg_dump usecase and
maybe also for IMPORT foreign schema where the SQL is generated by
PostgreSQL itself. But not for simulating statistics. In that case, if the
function happily installs statistics cooked by the user and those aren't
used anywhere, users may be misled by the plans that are generated
subsequently. Thus negating the very purpose of simulating statistics. Once
the feature is out there, we won't be able to restrict its usage unless we
document the possible anomalies.

--
Best Wishes,
Ashutosh Bapat

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-04-05 04:26:29 Re: Is this a problem in GenericXLogFinish()?
Previous Message Tom Lane 2024-04-05 04:15:43 Re: IPC::Run::time[r|out] vs our TAP tests