Re: vacuumdb changes for stats import/export - Mailing list pgsql-hackers

From John Naylor
Subject Re: vacuumdb changes for stats import/export
Date
Msg-id CANWCAZacHEinN0tYUwHahzeJguDoannP0Nksv9LnLPpFD2kb+g@mail.gmail.com
Whole thread Raw
In response to Re: vacuumdb changes for stats import/export  (Nathan Bossart <nathandbossart@gmail.com>)
List pgsql-hackers
On Wed, Mar 5, 2025 at 12:13 AM Nathan Bossart <nathandbossart@gmail.com> wrote:
>
> On Tue, Mar 04, 2025 at 01:05:17PM +0700, John Naylor wrote:
> > On Mon, Mar 3, 2025 at 11:21 PM Nathan Bossart <nathandbossart@gmail.com> wrote:
> >> I did that in v3.  I also tried to break up this comment into bullet points
> >> for better separation and logical flow.
> >
> > That's much easier to follow, thanks.
>
> Thanks for looking.  I'll probably commit 0001 sooner than later so that we
> can focus our attention on 0002.

+1

On 0002:

+        This option can only be used in conjunction with
+        <option>--analyze-only</option> and
<option>--analyze-in-stages</option>.

+ /* Prohibit --missing-only without --analyze-only or --analyze-in-stages */
+ if (vacopts.missing_only && !vacopts.analyze_only)
+ pg_fatal("cannot use the \"%s\" option without \"%s\" or \"%s\"",
+ "missing-only", "analyze-only", "analyze-in-stages");

The first is slightly ambiguous, so maybe "or" is better throughout.

+ " CROSS JOIN LATERAL (SELECT c.relkind IN ('p', 'I')) as p (inherited)\n"

Looking elsewhere in this file, I think we prefer something like
"(c.relkind OPERATOR(pg_catalog.=) ANY (array["
  CppAsString2(RELKIND_PARTITIONED_TABLE) ", "
  CppAsString2(RELKIND_PARTITIONED_INDEX) "]) as p (inherited)\n"

+ " AND NOT EXISTS (SELECT NULL FROM pg_catalog.pg_statistic s\n"
+ " WHERE s.starelid OPERATOR(pg_catalog.=) a.attrelid\n"
+ " AND s.staattnum OPERATOR(pg_catalog.=) a.attnum\n"
+ " AND s.stainherit OPERATOR(pg_catalog.=) p.inherited))\n");

IIUC correctly, pg_statistic doesn't store stats on itself, so this
causes the query result to always contain pg_statistic -- does that
get removed elsewhere?

--
John Naylor
Amazon Web Services



pgsql-hackers by date:

Previous
From: Israel Barth Rubio
Date:
Subject: Re: Add -k/--link option to pg_combinebackup
Next
From: Jakub Wartak
Date:
Subject: Re: AIO v2.5