Allow pg_dump --statistics-only to dump foreign table statistics?

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Allow pg_dump --statistics-only to dump foreign table statistics?
Date: 2025-06-13 07:19:26
Message-ID: 3772e4e4-ef39-4deb-bb76-aa8165f33fb6@oss.nttdata.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I noticed that pg_restore_relation|attribute_stats() can restore statistics
for foreign tables, but pg_dump --statistics-only doesn't include them.
Is there a reason why pg_dump skips statistics for foreign tables?
Are there any risks or concerns around including them?

Sorry if this has already been discussed. I tried searching but couldn't
find the discussion. If there is one, I'd appreciate it if you could point
me to it.

In case we decide it's reasonable to allow dumping statistics for foreign
tables, I've attached a patch that implements this behavior.

Regards,

--
Fujii Masao
NTT DATA Japan Corporation

Attachment Content-Type Size
v1-0001-pg_dump-Allow-pg_dump-to-dump-the-statistics-for-.patch text/plain 1.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Perumal Raj 2025-06-13 07:29:48 Re: Logical Replication slot disappeared after promote Standby
Previous Message jian he 2025-06-13 07:10:50 Re: ALTER TABLE ALTER CONSTRAINT misleading error message