Is it possible for postgres_fdw to push down queries on co-located tables? - Mailing list pgsql-hackers

From Jinhua Luo
Subject Is it possible for postgres_fdw to push down queries on co-located tables?
Date
Msg-id CAAc9rOyxdoo1GBpZA4LMvr2pq4T8kcC=6-OnHaaURZyQ4UUAag@mail.gmail.com
Whole thread Raw
Responses Re: Is it possible for postgres_fdw to push down queries on co-located tables?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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?


pgsql-hackers by date:

Previous
From: Michael Banck
Date:
Subject: Re: Online verification of checksums
Next
From: Jinhua Luo
Date:
Subject: What is OLD in INSTEAD OF trigger?