is parallel union all possible over dblink? - Mailing list pgsql-performance

From Svetlin Manavski
Subject is parallel union all possible over dblink?
Date
Msg-id BANLkTimwCWg6LGavaNU3YMJNcBiWppX9UQ@mail.gmail.com
Whole thread Raw
Responses Re: is parallel union all possible over dblink?
List 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

pgsql-performance by date:

Previous
From: Robert Haas
Date:
Subject: Re: change sample size for statistics
Next
From: "Marinos Yannikos"
Date:
Subject: Re: is parallel union all possible over dblink?