Re: Postgres_fdw join pushdown - wrong results with whole-row reference - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Postgres_fdw join pushdown - wrong results with whole-row reference
Date
Msg-id CA+TgmoaG5FBxgYp257r-egmaoMOUdOru8e3vLrfmu4XRnKdOjQ@mail.gmail.com
Whole thread Raw
In response to Re: Postgres_fdw join pushdown - wrong results with whole-row reference  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
List pgsql-hackers
On Wed, Jun 22, 2016 at 5:16 AM, Ashutosh Bapat
<ashutosh.bapat@enterprisedb.com> wrote:
>> However, if we support deparsing subqueries, the remote query in the above
>> example could be rewritten into something like this:
>>
>> SELECT ss.c2 FROM t1 LEFT JOIN (SELECT t2.a, ROW(a, b) FROM t2) ss(c1, c2)
>> ON (t1.a = ss.c1);
>>
>> So we would no longer need "CASE WHEN r2.* IS NOT NULL THEN ROW(r2.a,
>> r2.b) END" in the target list in the remote query.
>
> Right. Although, it means that the query processor at the other end has to
> do extra work for pulling up the subqueries.

I would be inclined to pick the method that generates cleaner SQL.  I
doubt that difference in optimization speed matters here - it's
presumably very small, especially when compared to the cost of the
network round-trip.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Postgres_fdw join pushdown - wrong results with whole-row reference
Next
From: Robert Haas
Date:
Subject: Re: Bug in to_timestamp().