| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
|---|---|
| To: | Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
| Subject: | Re: postgres_fdw: fix cumulative stats after imported foreign-table stats |
| Date: | 2026-07-06 14:51:36 |
| Message-ID: | 65F7302E-EFE3-4BF6-AA7F-9A41C82F6FBF@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On Jul 5, 2026, at 21:36, Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com> wrote:
>
> Hi Chao,
>
> On Sat, Jul 4, 2026 at 10:24 PM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>> I thought postgres_fdw was where we interact with the remote server, while analyze_rel() is the code deciding that ANALYZE succeeded. Ideally, cumulative ANALYZE reporting would be driven from that level, not from an FDW callback implementation.
>
> The division of labor would be arbitrary: as mentioned upthread, the
> FDW callback is designed as a function corresponding to
> do_analyze_rel(), which not only updates the stats system catalogs but
> reports to pgstats, so I think it's appropriate for the callback to do
> the report as well.
>
>> But I understand your concern about changing the ImportForeignStatistics API, so I’m fine with your proposal. I have integrated your changes into v2.
>
> Ok, thanks for the integration!
>
> @@ -230,7 +230,8 @@ analyze_rel(Oid relid, RangeVar *relation,
> if (fdwroutine->ImportForeignStatistics != NULL &&
> fdwroutine->ImportForeignStatistics(onerel, va_cols, elevel))
> stats_imported = true;
> - else
> +
> + if (!stats_imported)
>
> Is this a leftover?
>
Ah, yes, that’s a leftover. Reverted that in v3.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
| Attachment | Content-Type | Size |
|---|---|---|
| v3-0001-Fix-ANALYZE-reporting-after-imported-foreign-tabl.patch | application/octet-stream | 8.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alexander Pyhalov | 2026-07-06 14:51:45 | Re: Bug in asynchronous Append |
| Previous Message | Ayush Tiwari | 2026-07-06 14:45:56 | Re: pg_rewind: Skip vanished source files during traversal |