Re: postgres_fdw prefers fast plans

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: postgres_fdw prefers fast plans
Date: 2025-12-10 13:12:37
Message-ID: 2b2d15b9212ed1658603b001a43e23a64ecfc26d.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 2025-12-10 at 15:44 +0300, Alexander Pyhalov wrote:
> 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?

Why not simply set cursor_tuple_fraction to 1.0 in postgres_fdw sessions?

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2025-12-10 13:28:34 Re: [Patch] Improve the test src/test/postmaster/t/003_start_stop.pl
Previous Message Alexander Pyhalov 2025-12-10 12:44:04 postgres_fdw prefers fast plans