Re: Statistics Import and Export

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Jeff Davis <pgsql(at)j-davis(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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>, alvherre(at)alvh(dot)no-ip(dot)org
Subject: Re: Statistics Import and Export
Date: 2025-01-07 06:18:04
Message-ID: CADkLM=c6NHdXU+d+m1yASZ4NT_qye1LCnaU2Vgf8YJ80jJT-Qg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
>
> +1, I've been reviewing the vacuumdb portion and am planning to start a new
> thread in the near future. IIUC the bulk of the vacuumdb changes are
> relatively noncontroversial, we just haven't reached consensus on the user
> interface.
>
> --
> nathan
>

Attached is the latest (and probably last) unified patchset before parts
get spun off into their own threads.

0001 - This is the unified changes to pg_dump, pg_restore, pg_dumpall, and
pg_upgrade.

It incorporates most of what Jeff changed when he unified v36j, with typo
fixes spotted by Bruce. There was interest in splitting STATISTICS DATA
into RELATION STATISTICS DATA and ATTRIBUTE STATISTICS DATA. To do that,
we'd need to create separate TOC entries, and that doesn't seem worth it to
me.

There was also interest in changing the prefix for STATISTICS DATA.
However, the only special case for prefixes currently relies on an isData
flag. Since there is no isStatistics flag, we would either have to create
one, or do strcmps on te->description looking for "STATISTICS DATA". It's
do-able, but I'm not sure it's worth it.

0002-0005 are for extended stats.

0002 - This makes the input function for pg_ndistinct functional.
0003 - This makes the input function for pg_dependencies functional.
0004 - Makes several static functions in attribute_stats.c public for use
by extended stats. One of those is get_stat_attr_type(), which in the last
patchset was modified to take an attribute name rather than attnum, thus
saving a syscache lookup. However, extended stats identifies attributes by
attnum not name, so that optimization had to be set aside, at least
temporarily.

0005 - These implement the functions pg_set_extended_stats(),
pg_clear_extended_stats(), and pg_restore_extended_stats() and behave like
their relation/attribute equivalents. If we can get these committed and
used by pg_dump, then we don't have to debate how to handle post-upgrade
steps for users who happen to have extended stats vs the approximately
99.75% of users who do not have extended stats.

0006-0011 - These are the currently on-ice vacuumdb changes. 0006-0009 are
"do no harm" reorganizations which add no functionality but make 0011
clearer. 0010 introduces a new test check to TAP. This group will be spun
out into their own thread where we can focus on what if any changes happen
to vacuumdb. Any changes to vacuumdb are dependent on 0001 being committed,
and any changes to vacuumdb would likewise be informed by the commit status
of 0002-0005.

Work still to be done, in the near and less-near term:

* Adding statistic import for extended statistics objects (i.e. CREATE
STATISTICS) to pg_dump. Blocked by 0002-0005.
* Implementing optional statistics import in postgres_fdw. Blocked by 0001.

Attachment Content-Type Size
v37-0004-Expose-attribute-statistics-functions-for-use-in.patch text/x-patch 4.9 KB
v37-0002-Add-working-input-function-for-pg_ndistinct.patch text/x-patch 10.4 KB
v37-0003-Add-working-input-function-for-pg_dependencies.patch text/x-patch 12.6 KB
v37-0005-Add-extended-statistics-support-functions.patch text/x-patch 75.8 KB
v37-0001-Enable-dumping-of-table-index-stats-in-pg_dump.patch text/x-patch 51.9 KB
v37-0007-split-out-print_processing_notice.patch text/x-patch 2.4 KB
v37-0006-split-out-check_conn_options.patch text/x-patch 4.5 KB
v37-0009-preserve-catalog-lists-across-staged-runs.patch text/x-patch 6.7 KB
v37-0010-Add-issues_sql_unlike-opposite-of-issues_sql_lik.patch text/x-patch 1.5 KB
v37-0011-Add-force-analyze-to-vacuumdb.patch text/x-patch 12.1 KB
v37-0008-split-out-generate_catalog_list.patch text/x-patch 7.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2025-01-07 06:32:52 Re: POC: enable logical decoding when wal_level = 'replica' without a server restart
Previous Message 赵宇鹏 (宇彭) 2025-01-07 06:08:27 Re: Temporary Views Cleanup Issue