Re: Import Statistics in postgres_fdw before resorting to sampling.

From: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers(at)postgresql(dot)org, jkatz(at)postgresql(dot)org, nathandbossart(at)gmail(dot)com
Subject: Re: Import Statistics in postgres_fdw before resorting to sampling.
Date: 2026-04-07 10:09:46
Message-ID: CAPmGK17ZfpawE1wN6H6DfNfMg+GYoeXPFPFHu_X9EKGJo3ypKQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Apr 5, 2026 at 8:05 PM Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com> wrote:
> On Sat, Apr 4, 2026 at 1:01 AM Corey Huinker <corey(dot)huinker(at)gmail(dot)com> wrote:

> >> One thing I'm wondering is: we should rename ImportStatistics to
> >> ImportForeignStatistics, for consistency with ImportForeignSchema?
>
> > ImportForeignStatistics makes sense to me.
>
> Will rename.

Done.

> >> Also, we should rename fetch_stats to import_stats, for consistency
> >> with eg, import_default?
>
> > restore_stats is probably the better name, given that it is calling the pg_restore_*() functions.
>
> That sounds better, so will rename.

Done.

Here are other changes:

* I removed the implementation details from the docs in
postgres-fdw.sgml, as I think it is overly technical for
postgres-fdw.sgml, which is intended for end users. Also, I added a
note about resorting to sampling if stats import failed, and another
note about the user's responsibility to ensure that remote stats are
up-to-date.

* I added the docs about the new callback routine to fdwhandler.sgml.

* I added/tweaked comments.

* I Added one more test case.

* I did further cleanup and editorialization.

I think the patch is committable, so I will push it if no objections.
(Maybe we could add/improve some more comments, but I think we could
do that later if needed.)

Best regards,
Etsuro Fujita

Attachment Content-Type Size
v20-Add-remote-statistics-fetching-to-postgres_fdw.patch application/octet-stream 56.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2026-04-07 10:25:41 Re: Asynchronous MergeAppend
Previous Message John Naylor 2026-04-07 10:08:25 Re: Adding REPACK [concurrently]