pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Jessica Richard <rjessil@yahoo.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: select from dblink very slow
Date: Fri, 18 May 2007 09:31:11 -0700
Message-ID: <464DD4CF.5090807@joeconway.com> (raw)
In-Reply-To: <267133.52846.qm@web56415.mail.re3.yahoo.com>
References: <267133.52846.qm@web56415.mail.re3.yahoo.com>

Jessica Richard wrote:
> I need to joint select from table A in the current database A and dblink 
> to table B in database B, the result coming from tableB in db B is very 
> slow because I have to select all the rows from tableB from dblink then 
> do "where" with table A in the current db....doing dblink this way is 
> very very slow....
> 
> Any idea on how to improve this?

About the only thing I can think of using dblink would be to use a 
PL/pgSQL function to dynamically build and execute your query in such a 
way that the WHERE clause is pushed to the remote query.

Someone else suggested dbi-link as an alternative -- I don't know for 
sure, but suspect it will suffer from the same issue as dblink.

I also saw a suggestion of using different schemas instead of different 
databases. This is the best solution if it is feasible.

Finally, I don't know much about it, but perhaps PL/proxy would make it 
easier to push down your WHERE clause:
   https://developer.skype.com/SkypeGarage/DbProjects/PlProxy

HTH,

Joe



view thread (2+ messages)

Message-ID: <464DD4CF.5090807@joeconway.com>
Permalink:  ../464DD4CF.5090807@joeconway.com/
Also on:    postgresql.org/message-id/464DD4CF.5090807@joeconway.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: mail@joeconway.com, rjessil@yahoo.com
  Subject: Re: select from dblink very slow
  In-Reply-To: <464DD4CF.5090807@joeconway.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox