Re: Problems with plan estimates in postgres_fdw
Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>
From: Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>
To: Antonin Houska <ah@cybertec.at>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Andrew Gierth <andrew@tao11.riddles.org.uk>,
pgsql-hackers@postgresql.org
Date: 2019-03-27T08:15:02Z
Lists: pgsql-hackers
Attachments
(2019/03/26 21:41), Etsuro Fujita wrote: > (2019/03/20 20:47), Etsuro Fujita wrote: >> Attached is an updated version of the patch set. > > One thing I noticed while self-reviewing the patch for UPPERREL_FINAL > is: the previous versions of the patch don't show EPQ plans in EXPLAIN, > as shown in the below example, so we can't check if those plans are > constructed correctly, which I'll explain below: > In HEAD, this test case checks that a Result node is inserted atop of an > EPQ plan for a foreign join (if necessary) when the foreign join is at > the topmost join level (see discussion [1]), but the patched version > doesn't show EPQ plans in EXPLAIN, so we can't check that as-is. Should > we show EPQ plans in EXPLAIN? My inclination would be to not show them, > because that information would be completely useless for the user. In addition to the above reason, it would be waste of cycles to create the no-longer-needed EPQ plans to only show them in EXPLAIN, so I kept the patch as-is. > Another thing I noticed is: the previous versions make pointless another > test case added by commit 4bbf6edfb (and adjusted by commit 99f6a17dd) > that checks an EPQ plan constructed from multiple merge joins, because > they changed a query plan for that test case like the above. (Actually, > though, that test case doesn't need that EPQ plan already since it > doesn't involve regular tables and it never fires EPQ rechecks.) To > avoid that, I modified that test case accordingly. Attached is an updated version of the patchset. I did that test case modification in a separate patch (see the 0002 patch in the attached). I also added a bit more assertions and added/tweaked some comments. I'll check the patchset once more and add the commit messages in the next version. Best regards, Etsuro Fujita
Commits
-
postgres_fdw: Perform the (FINAL, NULL) upperrel operations remotely.
- d50d172e517c 12.0 landed
-
Refactor create_limit_path() to share cost adjustment code with FDWs.
- aef65db6769e 12.0 landed
-
postgres_fdw: Modify regression tests for EPQ-related planning problems.
- 0269edefacb7 12.0 landed
-
postgres_fdw: Perform the (ORDERED, NULL) upperrel operations remotely.
- ffab494a4d46 12.0 landed
-
Save PathTargets for distinct/ordered relations in root->upper_targets[].
- 3fdc374b5d24 12.0 landed
-
Split create_foreignscan_path() into three functions.
- 34ea1ab7fd30 12.0 cited
-
Fix test case for 'outer pathkeys do not match mergeclauses' fix.
- 99f6a17dd62a 11.0 cited
-
postgres_fdw: Avoid 'outer pathkeys do not match mergeclauses' error.
- 4bbf6edfbd5d 11.0 cited