Is it possible for postgres_fdw to push down queries on co-located tables?

From: Jinhua Luo <luajit(dot)io(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Is it possible for postgres_fdw to push down queries on co-located tables?
Date: 2018-09-18 10:55:38
Message-ID: CAAc9rOyxdoo1GBpZA4LMvr2pq4T8kcC=6-OnHaaURZyQ4UUAag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

That is, if table `foo` and table `bar` are both tables on the same
remote server, then when I do `select * from foo, bar`, can it
delegate the whole query on the remote side, rather than fetching rows
from both servers one by one and do merging on the local side?

For example:

```
foo=> explain select * from foreign_test2, foreign_test where m = id;
QUERY PLAN
-------------------------------------------------------------------------------------
Merge Join (cost=444.06..590.63 rows=9316 width=72)
Merge Cond: (foreign_test2.m = foreign_test.id)
-> Sort (cost=222.03..225.44 rows=1365 width=36)
Sort Key: foreign_test2.m
-> Foreign Scan on foreign_test2 (cost=100.00..150.95
rows=1365 width=36)
-> Sort (cost=222.03..225.44 rows=1365 width=36)
Sort Key: foreign_test.id
-> Foreign Scan on foreign_test (cost=100.00..150.95
rows=1365 width=36)
```

If the planning involving remote tables, could the planner push down
the queries once to gain the best efficiency?

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jinhua Luo 2018-09-18 11:05:23 What is OLD in INSTEAD OF trigger?
Previous Message Michael Banck 2018-09-18 10:37:02 Re: Online verification of checksums