Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 2A9619FB53D; Wed, 18 Jul 2007 13:14:47 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 03644-07; Wed, 18 Jul 2007 13:14:40 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from judo.dreamhost.com (judo.dreamhost.com [66.33.216.100]) by postgresql.org (Postfix) with ESMTP id 81B459FB51C; Wed, 18 Jul 2007 13:14:40 -0300 (ADT) Received: from smarty.dreamhost.com (smarty.dreamhost.com [208.113.175.8]) by judo.dreamhost.com (Postfix) with ESMTP id 53D9C179832; Wed, 18 Jul 2007 09:14:39 -0700 (PDT) Received: from slaughter.dreamhost.com (ip-66-33-201-182.dreamhost.com [66.33.201.182]) by smarty.dreamhost.com (Postfix) with ESMTP id DEE24EE24A; Wed, 18 Jul 2007 09:14:35 -0700 (PDT) Received: from webmail.benjaminarai.com (localhost [127.0.0.1]) by slaughter.dreamhost.com (Postfix) with ESMTP id A8EBA77236; Wed, 18 Jul 2007 09:14:35 -0700 (PDT) Received: from 131.107.65.118 (SquirrelMail authenticated user me@benjaminarai.com) by webmail.benjaminarai.com with HTTP; Wed, 18 Jul 2007 09:14:35 -0700 (PDT) Message-ID: <39160.131.107.65.118.1184775275.squirrel@webmail.benjaminarai.com> Date: Wed, 18 Jul 2007 09:14:35 -0700 (PDT) Subject: Parrallel query execution for UNION ALL Queries From: "Benjamin Arai" To: pgsql-performance@postgresql.org, pgsql-general@postgresql.org Reply-To: me@benjaminarai.com User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/737 X-Sequence-Number: 117338 Hi, If I have a query such as: SELECT * FROM (SELECT * FROM A) UNION ALL (SELECT * FROM B) WHERE blah='food'; Assuming the table A and B both have the same attributes and the data between the table is not partitioned in any special way, does Postgresql execute WHERE blah="food" on both table simultaiously or what? If not, is there a way to execute the query on both in parrallel then aggregate the results? To give some context, I have a very large amount of new data being loaded each week. Currently I am partitioning the data into a new table every month which is working great from a indexing standpoint. But I want to parrallelize searches if possible to reduce the perofrmance loss of having multiple tables. Benjamin