> -----Original Message-----
> From: Etsuro Fujita [mailto:fujita.etsuro@lab.ntt.co.jp]
> Sent: Tuesday, August 02, 2016 2:45 PM
> To: Kaigai Kouhei(海外 浩平); Ashutosh Bapat
> Cc: pgsql-hackers@postgresql.org
> Subject: Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans
>
> On 2016/08/02 13:32, Kouhei Kaigai wrote:
>
> I wrote:
> >> My concern here is EXPLAIN for foreign joins. I think it's another
> >> problem how we handle Foreign Scan plan nodes representing
> >> post-scan/join operations in EXPLAIN, so I'd like to leave that for
> >> another patch.
>
> > What is the post-scan/join operations? Are you saying EPQ recheck and
> > alternative local join plan?
>
> No. I mean e.g., aggregation, window functions, sorting, or table
> modification. In other words, Foreign Scan plan nodes created from
> ForeignPath paths created from GetForeignUpperPaths.
>
Why do you need to handle these upper paths individually?
FDW driver knows the remote query contains aggregation, window functions,
sorting, or table modification. It can give proper label.
If remote query contains partial aggregation and relations join, for
example, "Partial Agg + Scan" will be a proper label that shall be
followed by the "Foreign %s".
All you need to do are the two enhancements:
- Add "const char *explain_label" on the ForeignScanState or somewhere extension can set. It gives a label to be
printed.If NULL string is set, EXPLAIN shows "Foreign Scan" as a default.
- Add "Bitmapset explain_rels" on the ForeignScanState or somewhere extension can set. It indicates the relations to be
printedafter the "Foreign %s" token. If you want to print all the relations names underlying this ForeignScan node,
justcopy scanrelids bitmap. If NULL bitmap is set, EXPLAIN shows nothing as a default.
Please note that the default does not change the existing behavior.
Thanks,
--
NEC Business Creation Division / PG-Strom Project
KaiGai Kohei <kaigai@ak.jp.nec.com>