Search code examples
postgresqldblink

Pro & Cons using dblink postgresql


Can anyone suggest me what are the pros & cons of using dblink in Postgres?

I use dblink to connect to multiple database in my function in Postgres.


Solution

  • dblink is a great tool and it works very well.

    The main cons are:

    • If you run a query between 2 servers not on the same network you will have a lot of latency and the performance will be very degraded
    • If you use dblink in a JOIN, in order to process this JOIN a lot of rows will have to be transferred from the remote server which will use bandwidth and degrade performance

    If you have the possibility to use a single database for each query and not use multiple databases with dblink it will always be a better option.

    Read also this interesting thread: http://www.postgresql-archive.org/dblink-performance-td5056145.html