postgres_fdw prefers fast plans - Mailing list pgsql-hackers

From Alexander Pyhalov
Subject postgres_fdw prefers fast plans
Date
Msg-id e824a6135746b76ab1061fd4c9c377fe@postgrespro.ru
Whole thread Raw
Responses Re: postgres_fdw prefers fast plans
List 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).


1) 
https://www.postgresql.org/message-id/flat/CA%2BFpmFcmO5ctjYgQxSomJC%3DmCugqPo%2B51Le2wdxX0kWxjvBBig%40mail.gmail.com

-- 
Best regards,
Alexander Pyhalov,
Postgres Professional
Attachment

pgsql-hackers by date:

Previous
From: "Potapov Alexander"
Date:
Subject: [Patch] Improve the test src/test/postmaster/t/003_start_stop.pl
Next
From: Laurenz Albe
Date:
Subject: Re: postgres_fdw prefers fast plans