Hi Geoff,
Thanks for your swift reply. Breaking the query up like this would seem to address the problem:
CREATE UNLOGGED TABLE tmp AS
SELECT * 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
.
Jason Dusek