Thread: Re: does postgresql execute unions in parallel?

Re: does postgresql execute unions in parallel?

From
Gaetano Mendola
Date:
teknokrat wrote:

> If I have several selects joined with unions does postgresql execute the 
> concurrently or not?

nope.



Regards
Gaetan Mendola



Re: does postgresql execute unions in parallel?

From
Christopher Browne
Date:
mendola@bigfoot.com (Gaetano Mendola) writes:
> teknokrat wrote:
>> If I have several selects joined with unions does postgresql
>> execute the concurrently or not?
>
> nope.

I was talking with Jan about that very idea yesterday; this would seem
to be the place where PostgreSQL might take some (possibly even nearly
magical :-)) benefit from threading.

The usual way that people expect to use threading is for each
connection to have a thread.

If, instead, every _join_ had a thread, that would allow producers of
data to look for their data quasi-independently, passing result sets
upwards towards the return set to whatever thread was waiting to
consume the data.  

This would allow one complex query to take over a whole horde of
processors :-).

The "magic" part would be if the system decided, "The SEQ SCAN on the
table I'm looking at is a big one; let's split it into 4 chunks, doing
a virtual UNION ALL, and thereby filter bits of it in parallel on 4
CPUs."  That would provide many of the benefits Informix claimed from
"fragmentation" without having to fragment the table :-).
-- 
If this was helpful, <http://svcs.affero.net/rm.php?r=cbbrowne> rate me
http://www3.sympatico.ca/cbbrowne/lsf.html
Rules of the  Evil Overlord #187. "I will not  hold lavish banquets in
the middle of  a famine. The good PR among the  guests doesn't make up
for the bad PR among the masses."  <http://www.eviloverlord.com/>