On 22 Apr 2002 at 21:19, Devdas Bhagat wrote:
> I have ended up with an application that needs reporting on some tables
> from another database. I would prefer not to have to duplicate the whole
> table ( duplication of a few thousand entries required in real time ).
> Is it possible for the application to join across multiple postgresql
> databases?
Yes. It's possible. If you have tarball of postgres, try dblink function from
contrib directory. Pasting some stuff from readme..
-----------------------------------
Example usage
select dblink('hostaddr=127.0.0.1 port=5432 dbname=mydb user=postgres
password=mypasswd'
,'select f1, f2 from mytable');
Example usage
select dblink_tok(t1.dblink_p,0) as f1, dblink_tok(t1.dblink_p,1) as f2
from (select dblink('hostaddr=127.0.0.1 port=5432 dbname=mydb user=postgres
password=mypasswd'
,'select f1, f2 from mytable') as dblink_p) as t1;
-----------------------------------
Since it's a standard postgres function, I believe it should be possible to do
a join on the returned data set. Of course overall overhead won't be much less
than manually duplicating table but only thing is that it won't be visible to
you.
Never tried that thing myself but if two databases reside on same machine then
it should be as fast as two tables from same database...
HTH
Shridhar
_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help