I'm using PostgreSQL 9.3.
I have two separated databases which have a tables I need to join. As known I can use dblink
query to access to the remote database.
select *
from
customer
INNER JOIN
dblink('host=192.168.3.9 dbname=db2 user=postgres password=postgres', '
SELECT
id
FROM campaign_customer
') AS table2 (
int id
date_added char(50)
) ON customer.cust_id = table2.id
It looks a bit strange. Does such a solution cause a potential (I mean join
via dblink
) risk? If yes, can you explain what exact is that risk? I would like to look at any other possible solution.
I'm especially interested in the performance of such query and how it can affect to a transaction to a different database?