| From: | Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru> |
|---|---|
| To: | PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | postgres_fdw prefers fast plans |
| Date: | 2025-12-10 12:44:04 |
| Message-ID: | e824a6135746b76ab1061fd4c9c377fe@postgrespro.ru |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi.
There's a long-standing issue with postgres_fdw - as it uses cursors, it
prefers plans, optimized for fetching first rows. In bad scenarios this
leads to suboptimal choice of join methods (e.g. choosing nest loop over
hash join) on remote side. I've crafted WIP patch, which tries to fix
this issue. It adds FETCH ALL cursors and uses them in postgres_fdw.
What do you think? Should we go in this direction?
I've looked at attempt to avoid cursors with postgres_fdw [1], but it
seems to avoid dealing with async foreign plans (and looks more
intrusive).
--
Best regards,
Alexander Pyhalov,
Postgres Professional
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Add-DECLARE-CURSOR-.-FETCH-ALL-and-use-it-in-postgre.patch | text/x-diff | 51.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Laurenz Albe | 2025-12-10 13:12:37 | Re: postgres_fdw prefers fast plans |
| Previous Message | Potapov Alexander | 2025-12-10 12:32:22 | [Patch] Improve the test src/test/postmaster/t/003_start_stop.pl |