Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-24 Thread Etsuro Fujita
On 2016/08/25 1:08, Robert Haas wrote: On Tue, Aug 23, 2016 at 11:18 PM, Etsuro Fujita wrote: OK, I think we should fix the issue that postgres_fdw produces incorrect aliases for joining relations shown in the Relations line in EXPLAIN for a join pushdown query like the above) in advance of the

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-24 Thread Robert Haas
On Tue, Aug 23, 2016 at 11:18 PM, Etsuro Fujita wrote: >> Yes, it seems what we are doing now is not consistent with what >> happens for plain tables; that should probably be fixed. > > OK, I think we should fix the issue that postgres_fdw produces incorrect > aliases for joining relations shown i

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-23 Thread Etsuro Fujita
On 2016/08/10 5:19, Robert Haas wrote: On Mon, Aug 8, 2016 at 12:22 AM, Etsuro Fujita wrote: One thing we need to do to leave that as is would be to fix a bug that I pointed out upthred. Let me explain about that again. The EXPLAIN command selects relation aliases to be used in printing a que

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-09 Thread Robert Haas
On Mon, Aug 8, 2016 at 12:22 AM, Etsuro Fujita wrote: >>> I noticed that currently the core doesn't show any information on the >>> target >>> relations involved in a foreign/custom join in EXPLAIN, by itself. >> I think that's a feature, not a bug. > I agree with you. I'd leave that for 10.0. I

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-07 Thread Etsuro Fujita
On 2016/08/05 21:47, Robert Haas wrote: On Tue, Jul 26, 2016 at 11:20 PM, Etsuro Fujita wrote: I noticed that currently the core doesn't show any information on the target relations involved in a foreign/custom join in EXPLAIN, by itself. I think that's a feature, not a bug. I agree with y

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-05 Thread Robert Haas
On Tue, Jul 26, 2016 at 11:20 PM, Etsuro Fujita wrote: > I noticed that currently the core doesn't show any information on the target > relations involved in a foreign/custom join in EXPLAIN, by itself. I think that's a feature, not a bug. > postgres_fdw shows the target relations in the Relatio

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-05 Thread Etsuro Fujita
On 2016/08/02 21:35, Etsuro Fujita wrote: I removed the Relations line. Here is an updated version of the patch. I revised code and comments a bit. Attached is an updated version of the patch. Best regards, Etsuro Fujita explain-for-foreign-join-pushdown-v2.patch Description: binary/oct

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-04 Thread Etsuro Fujita
On 2016/08/04 18:03, Kouhei Kaigai wrote: Kaigai-san wrote: Also, the logic to print "Foreign (Scan|Insert|Update|Delete)" is different from what I suggested. I'm suggesting to allow extension giving a label to fill up "Foreign %s" format. Please explain why your choice is better than my propos

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-04 Thread Kouhei Kaigai
> -Original Message- > From: Etsuro Fujita [mailto:fujita.ets...@lab.ntt.co.jp] > Sent: Thursday, August 04, 2016 4:42 PM > To: Kaigai Kouhei(海外 浩平); pgsql-hackers@postgresql.org > Subject: Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown > plans >

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-04 Thread Etsuro Fujita
On 2016/08/02 22:02, Kouhei Kaigai wrote: I wrote: I removed the Relations line. Here is an updated version of the patch. * As I said upthread, I left the upper-relation handling for another patch. Currently, the patch prints "Foreign Scan" with no relations in that case. * I kept custom joi

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-02 Thread Kouhei Kaigai
> -Original Message- > From: Etsuro Fujita [mailto:fujita.ets...@lab.ntt.co.jp] > Sent: Tuesday, August 02, 2016 9:36 PM > To: Kaigai Kouhei(海外 浩平); pgsql-hackers@postgresql.org > Subject: Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown > plans >

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-02 Thread Etsuro Fujita
On 2016/08/01 20:15, Etsuro Fujita wrote: I thought about the Relations line a bit more and noticed that there are cases where the table reference names for joining relations in the Relations line are printed incorrectly. Here is an example: postgres=# explain verbose select * from (select t1.a

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-01 Thread Kouhei Kaigai
> -Original Message- > From: Etsuro Fujita [mailto:fujita.ets...@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

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-01 Thread Etsuro Fujita
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 opera

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-01 Thread Kouhei Kaigai
> On 2016/08/01 22:25, Kouhei Kaigai wrote: > > I wrote: > >>> a broader > >>> word like "Processing" seems to work well because we allow various > >>> kinds of operations to the remote side, in addition to scans/joins, > >>> to be performed in that one Foreign Scan node indicated

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-01 Thread Etsuro Fujita
On 2016/08/01 22:25, Kouhei Kaigai wrote: I wrote: a broader word like "Processing" seems to work well because we allow various kinds of operations to the remote side, in addition to scans/joins, to be performed in that one Foreign Scan node indicated by "Foreign Processing",

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-01 Thread Kouhei Kaigai
> -Original Message- > From: Etsuro Fujita [mailto:fujita.ets...@lab.ntt.co.jp] > Sent: Monday, August 01, 2016 8:26 PM > To: Ashutosh Bapat > Cc: Kaigai Kouhei(海外 浩平); pgsql-hackers@postgresql.org > Subject: Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdow

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-01 Thread Etsuro Fujita
On 2016/08/01 20:31, Ashutosh Bapat wrote: I thought about the Relations line a bit more and noticed that there are cases where the table reference names for joining relations in the Relations line are printed incorrectly. Here is an example: postgres=# explain verbose select *

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-01 Thread Ashutosh Bapat
> I thought about the Relations line a bit more and noticed that there are > cases where the table reference names for joining relations in the > Relations line are printed incorrectly. Here is an example: > > postgres=# explain verbose select * from (select t1.a, t2.a from ft1 t1, > ft2 t2 where

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-01 Thread Etsuro Fujita
On 2016/07/29 13:28, Ashutosh Bapat wrote: I wrote: Probably something like this: Foreign Processing Remote Operations: ... In the Remote Operations line, the FDW/extension could print any info about remote operati

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-08-01 Thread Etsuro Fujita
On 2016/07/29 13:05, Etsuro Fujita wrote: In a foreign-join case, however, we can't see such relations from the EXPLAIN printed *by core*. postgres_fdw avoids this issue by adding such relations to the EXPLAIN using ExplainForeignScan as shown in the below example, but since such relations are e

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-07-28 Thread Kouhei Kaigai
> I wrote: > >> That may be so, but my point is that the target relations involved in > >> the foreign join (ie, ft1 and ft2) should be printed somewhere in the > >> EXPLAIN output by core, as in EXPLAIN for a simple foreign table scan. > > > Why? According to your rule, Hash Join should take "on

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-07-28 Thread Ashutosh Bapat
I wrote: > >> Probably something like this: >>> >>>Foreign Processing >>> Remote Operations: ... >>> >>> In the Remote Operations line, the FDW/extension could print any info >>> about remote operations, eg, "Scan/Join + Aggregate". >>> >> > "Foreign" implies this node is processed by FDW,

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-07-28 Thread Etsuro Fujita
On 2016/07/28 22:11, Kouhei Kaigai wrote: I wrote: That may be so, but my point is that the target relations involved in the foreign join (ie, ft1 and ft2) should be printed somewhere in the EXPLAIN output by core, as in EXPLAIN for a simple foreign table scan. Why? According to your rule, Ha

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-07-28 Thread Kouhei Kaigai
> On 2016/07/28 10:01, Kouhei Kaigai wrote: > > What I'm saying is here: > > > EXPLAIN (COSTS false, VERBOSE) > > SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) ORDER BY > > t1.c3, t1.c1 OFFSET 100 LIMIT 10; > > QUERY PLAN > > -

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-07-28 Thread Etsuro Fujita
On 2016/07/28 10:01, Kouhei Kaigai wrote: What I'm saying is here: EXPLAIN (COSTS false, VERBOSE) SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) ORDER BY t1.c3, t1.c1 OFFSET 100 LIMIT 10; QUERY PLAN --- Limit

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-07-27 Thread Kouhei Kaigai
> On 2016/07/27 13:51, Kouhei Kaigai wrote: > > This output is, at least, not incorrect. > > This ForeignScan actually scan a relation that consists of two joined > > tables on the remote side. So, not incorrect, but may not convenient for > > better understanding by users who don't have deep inter

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-07-27 Thread Etsuro Fujita
On 2016/07/27 13:51, Kouhei Kaigai wrote: This output is, at least, not incorrect. This ForeignScan actually scan a relation that consists of two joined tables on the remote side. So, not incorrect, but may not convenient for better understanding by users who don't have deep internal knowledge.

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-07-27 Thread Etsuro Fujita
On 2016/07/27 13:09, Ashutosh Bapat wrote: The patch always prints ForeignJoin when scanrelid <= 0, which would be odd considering that FDWs can now push down post-join operations. We need to device a better way to convey post-join operations. May be something like Foreign Grouping, aggregation o

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-07-26 Thread Kouhei Kaigai
> I noticed that currently the core doesn't show any information on the > target relations involved in a foreign/custom join in EXPLAIN, by > itself. Here is an example: > > -- join two tables > EXPLAIN (COSTS false, VERBOSE) > SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) ORDER

Re: [HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-07-26 Thread Ashutosh Bapat
On Wed, Jul 27, 2016 at 8:50 AM, Etsuro Fujita wrote: > Hi, > > I noticed that currently the core doesn't show any information on the > target relations involved in a foreign/custom join in EXPLAIN, by itself. > Here is an example: > > -- join two tables > EXPLAIN (COSTS false, VERBOSE) > SELECT

[HACKERS] Oddity in EXPLAIN for foreign/custom join pushdown plans

2016-07-26 Thread Etsuro Fujita
Hi, I noticed that currently the core doesn't show any information on the target relations involved in a foreign/custom join in EXPLAIN, by itself. Here is an example: -- join two tables EXPLAIN (COSTS false, VERBOSE) SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2 ON (t1.c1 = t2.c1) ORDER BY