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

From Etsuro Fujita
Subject Re: [HACKERS] Push down more full joins in postgres_fdw
Date
Msg-id 920e660b-6fec-6022-759d-e96e37dd5984@lab.ntt.co.jp
Whole thread Raw
In response to Re: [HACKERS] Push down more full joins in postgres_fdw  (Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>)
Responses Re: [HACKERS] Push down more full joins in postgres_fdw  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
Re: [HACKERS] Push down more full joins in postgres_fdw  (Michael Paquier <michael.paquier@gmail.com>)
Re: [HACKERS] Push down more full joins in postgres_fdw  (David Steele <david@pgmasters.net>)
List pgsql-hackers
On 2017/01/27 21:25, Etsuro Fujita wrote:
> On 2017/01/27 20:04, Ashutosh Bapat wrote:
>> I think we should pick up your patch on
>> 27th December, update the comment per your mail on 5th Jan. I will
>> review it once and list down the things left to committer's judgement.

> Sorry, I started thinking we went in the wrong direction.  I added to
> deparseSelectStmtForRel build_subquery_tlists, which creates a tlist for
> each subquery present in a given join tree prior to deparsing a whole
> remote query.  But that's nothing but an overhead; we need to create a
> tlist for the top-level query because we use it as fdw_scan_tlist, but
> not for subqueries, and we need to create retrieved_attrs for the
> top-level query while deparsing the targetlist in
> deparseExplicitTargetList, but not for subqueries.  So, we should need
> some work to avoid such a useless overhead.

I think we can avoid the useless overhead by adding a new function, 
deparseSubqueryTargetList, that deparses expressions in the given 
relation's reltarget, not the tlist, as a SELECT clause of the subquery 
representing the given relation.  That would also allow us to make the 
1-to-1 relationship between the subquery output columns and their 
aliases more explicit, which was your original comment.  Please find 
attached the new version.  (The patch doesn't need the patch to avoid 
duplicate construction of the tlist, discussed upthread.)

Other changes:
* I went back to make_outerrel_subquery and make_innerrel_subquery, 
which are flags to indicate whether to deparse the input relations as 
subqueries.  is_subquery_rel would work well for handling the cases of 
full joins with restrictions on the input relations, but I noticed that 
that wouldn't work well when extending to handle the cases where we 
deparse the input relations as subqueries to evaluate PHVs remotely.
* Since appendSubqueryAlias in the previous patch is pretty small, I 
included the code into deparseRangeTblRef.

Best regards,
Etsuro Fujita

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

pgsql-hackers by date:

Previous
From: Vladimir Rusinov
Date:
Subject: Re: [HACKERS] [PATCH] Rename pg_switch_xlog to pg_switch_wal
Next
From: tushar
Date:
Subject: Re: [HACKERS] Parallel Index-only scan