Re: explain plans for foreign servers

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: dinesh salve <cooltodinesh(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, Jeff Davis <pgsql(at)j-davis(dot)com>
Subject: Re: explain plans for foreign servers
Date: 2025-12-03 22:40:26
Message-ID: CAA5RZ0skXF+d7SANSnMi3xMTs9zr6dZadyc5OEtPiMnw-rGizw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> I have refactored the commit on the latest version of PG and added a few more tests.

Thanks for the update!

> To simplify the roll out of this feature, I decided to work on analyze=false use case first.

I did not go through the entire patch yet, but a few things stood out
from my first pass.

1/
RegisterExtensionExplainOption is called during _PG_init, which is fine, but I
also wonder if we can call this during postgresExplainForeignScan as well?

The reason being is for _PG_init to be invoked, the user must load postgres_fdw
(LOAD, session_preload_libraries, shared_preload_libraries), which from my
experience is not very common in postgres_fdw. Users ordinarily just
"CREATE EXTENSION..."

So this needs to be documented [0]

2/

Does this behave sanely with multiple fdw connections? Can we add
tests for this?

+
+ /*
+ * add one of the tables to
foreign_scan_table to get the
+ * serverId for remote plans
+ */
+ if (list_length(foreign_scan_table) == 0)
+ foreign_scan_table =
lappend_oid(foreign_scan_table, rte->relid);
+

[0] https://www.postgresql.org/docs/current/postgres-fdw.html

--
Sami Imseih
Amazon Web Services (AWS)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2025-12-03 22:55:44 Re: [PATCH] Add error hints for invalid COPY options
Previous Message Greg Burd 2025-12-03 22:06:06 Re: Expanding HOT updates for expression and partial indexes