Re: postgres_fdw bug in 9.6
Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>
From: Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>,
Jeff Janes <jeff.janes@gmail.com>,
Robert Haas <robertmhaas@gmail.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2016-12-16T02:25:27Z
Lists: pgsql-hackers
On 2016/12/16 1:39, Tom Lane wrote: > Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp> writes: >> On 2016/12/13 23:13, Ashutosh Bapat wrote: >>> A possible short-term fix may be this: instead of picking any random >>> path to stick into fdw_outerpath, we choose a path which covers the >>> pathkeys of ForeignPath. >> Seems reasonable. > No, because GetExistingLocalJoinPath is called once per relation not once > per path. Even if we were willing to eat the overhead of calling it once > per path, we'd have to give up considering foreign paths with sort orders > that there wasn't any cheap way to produce locally. Hmm, I agree on that point that giving it up might result in a bad plan. As I said upthread, an alternative I am thinking is (1) to create an equivalent nestloop join path using inner/outer paths of a foreign join path, except when that join path implements a full join, in which case a merge/hash join path is used, (2) store it in fdw_outerpath as-is, and (3) during an EPQ recheck, apply postgresRecheckForeignScan to the outer subplan created from the fdw_outerpath as-is. What do you think about that? Best regards, Etsuro Fujita
Commits
-
Fix test case for 'outer pathkeys do not match mergeclauses' fix.
- d397f558d555 9.6.7 landed
- 92123c6ea212 10.2 landed
- 99f6a17dd62a 11.0 landed
-
postgres_fdw: Avoid 'outer pathkeys do not match mergeclauses' error.
- 4a81c022975e 9.6.7 landed
- 3f05a30b50a7 10.2 landed
- 4bbf6edfbd5d 11.0 landed
-
postgres_fdw: Consider foreign joining and foreign sorting together.
- aa09cd242fa7 9.6.0 cited
-
Allow foreign and custom joins to handle EvalPlanQual rechecks.
- 385f337c9f39 9.6.0 cited
-
Allow FDWs to push down quals without breaking EvalPlanQual rechecks.
- 5fc4c26db512 9.6.0 cited