Re: Statistics Import and Export

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, Stephen Frost <sfrost(at)snowman(dot)net>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(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>, alvherre(at)alvh(dot)no-ip(dot)org
Subject: Re: Statistics Import and Export
Date: 2024-08-16 00:53:37
Message-ID: CADkLM=eu72o_=s2ARNe8yB-16AUm+_iU0tq_ALeeUUxCCqJkOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
>
> function attribute_statsitics_update() is significantly shorter. (Thank
> you for a good set of tests, by the way, which sped up the refactoring
> process.)
>

yw

> * Remind me why the new stats completely replace the new row, rather
> than updating only the statistic kinds that are specified?
>

because:
- complexity
- we would then need a mechanism to then tell it to *delete* a stakind
- we'd have to figure out how to reorder the remaining stakinds, or spend
effort finding a matching stakind in the existing row to know to replace it
- "do what analyze does" was an initial goal and as a result many test
cases directly compared pg_statistic rows from an original table to an
empty clone table to see if the "copy" had fidelity.

> * I'm not sure what the type_is_scalar() function was doing before,
> but I just removed it. If it can't find the element type, then it skips
> over the kinds that require it.
>

that may be sufficient,

> * I introduced some hard errors. These happen when it can't find the
> table, or the attribute, or doesn't have permissions. I don't see any
> reason to demote those to a WARNING. Even for the restore case,
> analagous errors happen for COPY, etc.
>

I can accept that reasoning.

> * I'm still sorting through some of the type info derivations. I
> think we need better explanations about why it's doing exactly the
> things it's doing, e.g. for tsvector and multiranges.

I don't have the specifics of each, but any such cases were derived from
similar behaviors in the custom typanalyze functions, and the lack of a
custom typanalyze function for a given type was taken as evidence that the
type was adequately handled by the default rules. I can see that this is an
argument for having a second stats-specific custom typanalyze function for
datatypes that need them, but I wasn't ready to go that far myself.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2024-08-16 01:12:33 Re: Remaining dependency on setlocale()
Previous Message Thomas Munro 2024-08-16 00:48:07 Re: Thread-safe nl_langinfo() and localeconv()