Re: Statistics Import and Export

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Statistics Import and Export
Date: 2023-10-31 07:25:17
Message-ID: CADkLM=dTHVSrcGBAstjshoZBXKJgWjzN3Vj53KQ9fORqvkaN5Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
>
> Yeah, that use makes sense as well, and if so then postgres_fdw would
> likely need to be aware of the appropriate query for several versions back
> - they change, not by much, but they do change. So now we'd have each query
> text in three places: a system view, postgres_fdw, and the bin/scripts
> pre-upgrade program. So I probably should consider the best way to share
> those in the codebase.
>
>
Attached is v2 of this patch.

New features:
* imports index statistics. This is not strictly accurate: it re-computes
index statistics the same as ANALYZE does, which is to say it derives those
stats entirely from table column stats, which are imported, so in that
sense we're getting index stats without touching the heap.
* now support extended statistics except for MCV, which is currently
serialized as an difficult-to-decompose bytea field.
* bare-bones CLI script pg_export_stats, which extracts stats on databases
back to v12 (tested) and could work back to v10.
* bare-bones CLI script pg_import_stats, which obviously only works on
current devel dbs, but can take exports from older versions.

Attachment Content-Type Size
v2-0001-Additional-internal-jsonb-access-functions.patch text/x-patch 2.4 KB
v2-0002-Add-system-view-pg_statistic_export.patch text/x-patch 18.2 KB
v2-0003-Add-pg_import_rel_stats.patch text/x-patch 58.8 KB
v2-0004-Add-pg_export_stats-pg_import_stats.patch text/x-patch 49.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message torikoshia 2023-10-31 07:26:18 Re: Add new option 'all' to pg_stat_reset_shared()
Previous Message Richard Guo 2023-10-31 06:19:31 Re: A performance issue with Memoize