Re: Allow pg_dump --statistics-only to dump foreign table statistics? - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: Allow pg_dump --statistics-only to dump foreign table statistics?
Date
Msg-id aFCJ5iIEVxrr7JnH@nathan
Whole thread Raw
In response to Re: Allow pg_dump --statistics-only to dump foreign table statistics?  (Corey Huinker <corey.huinker@gmail.com>)
Responses Re: Allow pg_dump --statistics-only to dump foreign table statistics?
List pgsql-hackers
On Mon, Jun 16, 2025 at 03:39:07PM -0400, Corey Huinker wrote:
> If we aren't exporting stats for foreign tables then that is an oversight,
> the intention always was to fetch all available statistics for all
> relations. I can't offhand think of where we even have the option to
> exclude them.

getRelationStatistics() enumerates the relation kinds:

    if ((relkind == RELKIND_RELATION) ||
        (relkind == RELKIND_PARTITIONED_TABLE) ||
        (relkind == RELKIND_INDEX) ||
        (relkind == RELKIND_PARTITIONED_INDEX) ||
        (relkind == RELKIND_MATVIEW))

The proposed patch [0] adds RELKIND_FOREIGN_TABLE to this list.  That
appears to be the only missing relation kind that ANALYZE handles.

[0] https://postgr.es/m/attachment/177608/v1-0001-pg_dump-Allow-pg_dump-to-dump-the-statistics-for-.patch

-- 
nathan



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: pg_dump --with-* options
Next
From: Nathan Bossart
Date:
Subject: Re: Per-role disabling of LEAKPROOF requirements for row-level security?