Re: Problems with plan estimates in postgres_fdw

From: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: Antonin Houska <ah(at)cybertec(dot)at>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Problems with plan estimates in postgres_fdw
Date: 2019-03-27 08:15:02
Message-ID: 5C9B3106.5090001@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

(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

Attachment Content-Type Size
v8-0001-postgres_fdw-Perform-UPPERREL_ORDERED-step-remotely.patch text/x-patch 45.3 KB
v8-0002-postgres_fdw-Modify-regression-test-case-for-EPQ-pla.patch text/x-patch 21.5 KB
v8-0003-Refactor-create_limit_path-to-share-cost-adjustment-.patch text/x-patch 4.8 KB
v8-0004-postgres_fdw-Perform-UPPERREL_FINAL-step-remotely.patch text/x-patch 102.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2019-03-27 08:23:51 Re: Ordered Partitioned Table Scans
Previous Message Rafia Sabih 2019-03-27 08:06:04 Re: explain plans with information about (modified) gucs