Re: Joins between foreign tables

From: Jason Dusek <jason(dot)dusek(at)gmail(dot)com>
To: Geoff Montee <geoff(dot)montee(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Joins between foreign tables
Date: 2015-06-08 22:41:40
Message-ID: CAO3NbwMbmyA9HdnJJ9hrtsbrsgDkzajraXts_y4TyUx_sWwT9A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Geoff,

Thanks for your swift reply. Breaking the query up like this would seem to
address the problem:

CREATE UNLOGGED TABLE tmp ASSELECT * FROM table_on_server2
WHERE created_at >= date_trunc('day', now());
SELECT email FROM table_on_server1 WHERE id IN (SELECT user_id FROM tmp);

It would stand to reason that the IN list could be pushed down to the
foreign server; but this query’s performance is no better than the direct
join between table_on_server1 and table_on_server2.
Best Regards,

Jason Dusek

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ian Barwick 2015-06-08 23:17:20 Re: Postgresql BDR Replication Setup Issue
Previous Message Anderson Valadares 2015-06-08 22:20:39 Re: Momentary Delay