Re: accessing multiple databases using dblink

From: "Marko Kreen" <markokr(at)gmail(dot)com>
To: "f(dot)zamboni(at)mastertraining" <f(dot)zamboni(at)mastertraining(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: accessing multiple databases using dblink
Date: 2007-12-13 13:31:24
Message-ID: e51f66da0712130531v1b02341bk70d6396802d71309@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/13/07, f(dot)zamboni(at)mastertraining <f(dot)zamboni(at)mastertraining(dot)it> wrote:
> Good morning to everybody,
> I've to resolve this situation: I've a collection of many different databases, all identical, and the name of those databases is stored inside a table in another "central
> management" database.
> In an ideal world, I'd like with a single query to be able to recover the name of each database from the table that does contains them, and use it to do a query on each table on
> each databse joining the results.
> At the moment I'm doing it by external code, but performaces are awfull...
> At first I tough something similar to
> select * from tab_databases,dblink('dbname=' || tab_databases.name,'select count(id) from tab_data')
> could work, but it seems its not allowed to reference rows from another table inside the from level.
>
> Putting dblink outside that level allow me to use the dynamic dbname, but in that case I would need a row resource, while dblink give back a table resource...
>
> Is it possible to resolve this inside the databse?
> Thanks a lot...

This seems to be appropriate task for pl/proxy:

https://developer.skype.com/SkypeGarage/DbProjects/PlProxy

--
marko

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2007-12-13 13:37:39 Re: Need LIMIT and ORDER BY for UPDATE
Previous Message Alvaro Herrera 2007-12-13 13:31:19 Re: [GENERAL] Slow PITR restore