is parallel union all possible over dblink?

From: Svetlin Manavski <svetlin(dot)manavski(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: is parallel union all possible over dblink?
Date: 2011-06-29 11:55:58
Message-ID: BANLkTimwCWg6LGavaNU3YMJNcBiWppX9UQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi all,
I am running PostgreSQL 9.0 on a number of nodes in an application level
cluster (there is different data on different machines). Currently a
PL/pgSQL function generates automatically aggregation queries like the
following:

(select * from appqosfe.F_total_utilization(1306918800000000000::INT8, NULL,
60000000000::INT8, NULL))
UNION ALL
(SELECT * from dblink('remote1','select * from
appqosfe.F_total_utilization(1306918800000000000::INT8, NULL,
60000000000::INT8, NULL)') as T1(detectroid numeric, timegroup numeric,
numbytes numeric, numpackets numeric))
order by timegroup asc

The above example supposes that only 2 nodes are active (one local and one
remote). Here I can clearly see that the remote sub-query starts only when
the local one is completed so the total time grows linearly with the number
of nodes.

Question: Is there a way to get the same result from within a PL/pgSQL
function but running all the sub-queries in parallel? In case it is not
directly available, which one would be the simplest way to implement it in
my application? (I am very keen to avoid the obvious solution of an
additional multi-threaded layer which would do it out of the RDBMS)

Thank you,
Svetlin Manavski

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Marinos Yannikos 2011-06-29 18:37:18 Re: is parallel union all possible over dblink?
Previous Message Robert Haas 2011-06-29 02:55:45 Re: [PERFORM] change sample size for statistics