Re: Push down more full joins in postgres_fdw - Mailing list pgsql-hackers

From Etsuro Fujita
Subject Re: Push down more full joins in postgres_fdw
Date
Msg-id c73e2a65-b851-bd2c-e6b6-2a7d5f5fbdbf@lab.ntt.co.jp
Whole thread Raw
In response to Re: Push down more full joins in postgres_fdw  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
List pgsql-hackers
On 2016/09/27 13:33, Ashutosh Bapat wrote:

I wrote:
>>>>>> ISTM that the use of the same RTI for subqueries in multi-levels in a
>>>>>> remote
>>>>>> SQL makes the SQL a bit difficult to read.  How about using the
>>>>>> position
>>>>>> of
>>>>>> the join rel in join_rel_list, (more precisely, the position plus
>>>>>> list_length(root->parse->rtable)), instead?

I wrote:
>> The join rel is appended to the end of the list, so I was thinking to get
>> the position info by list_length during postgresGetForeignJoinPaths.

> That's true only when the paths are being added to a newly created
> joinrel. But that's not true always. We may add paths with different
> joining order to an existing joinrel, in which case list_length would
> not give its position. Am I missing something?

I think you are right, but postgresGetForeignJoinPaths only allows us to 
add a foreign join path to a newly created joinrel.  The reason is 
because that routine skips all its work after the first call for that 
joinrel, by checking to see if joinrel->fdw_private is not NULL.  So, I 
think it's reasonable to get the position by list_length in that routine.

Best regards,
Etsuro Fujita





pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Quorum commit for multiple synchronous replication.
Next
From: Heikki Linnakangas
Date:
Subject: Re: Password identifiers, protocol aging and SCRAM protocol