Re: Accessing 2 different databases in the same query ?

From: Nagib Abi Fadel <nagib_postgres(at)yahoo(dot)com>
To: Darko Prenosil <darko(dot)prenosil(at)finteh(dot)hr>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Accessing 2 different databases in the same query ?
Date: 2003-06-02 16:07:11
Message-ID: 20030602160711.79753.qmail@web21408.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Well actually the 2 databases are on the same machine, so i wanted to know if using the dblink for accessing 2 tables each one in a different database will dramatically slow down the query (specially if it's a join query), Comparing to a query on 2 tables on the same database.
If it's the case i would consider replacing the 2 databases with one database, but does this have any disadvantage does it make queries slower if the database grow in size ???

Thx for your help

Darko Prenosil <darko(dot)prenosil(at)finteh(dot)hr> wrote:

On Monday 02 June 2003 10:39, Nagib Abi Fadel wrote:
> From what i read dblink let's us access another database in the same query
> ... Which is great. But does it slow down the query ??

What do You mean slow down ? In compare to what ?
If You question was is such query slower than the query on tables in local
database, the answer is YES. Let me describe the mechanism of dblink:
Your backend process becomes client of another backend (on same or different
server). dblink establishes connection to remote database, executes the
query, and send data to Your backend.

I use dblink over slow ISDN connection, so You can figure out how slow it can
be, but that is the beauty of dblink: You can query servers that are anywhere
on the network !

> And what about making references between tables (creating foreign keys) is
> it possible ?????
>

No, but you can create "remote view" using dblink and then do the same thing
using triggers(foreign keys are just specific triggers).
There are few samples in dblink documentation - check them out !

Regards !

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

---------------------------------
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2003-06-02 16:28:50 Re: The best
Previous Message Ian Harding 2003-06-02 15:47:15 Re: installing contrib/tsearch with a FreeBSD Port