X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A658D3A68DD for ; Tue, 14 Dec 2004 01:45:45 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56715-07 for ; Tue, 14 Dec 2004 01:45:29 +0000 (GMT) Received: from ew.mimos.my (unknown [192.228.129.34]) by svr1.postgresql.org (Postfix) with ESMTP id 0015A3A4309 for ; Tue, 14 Dec 2004 01:45:30 +0000 (GMT) Received: from mimos.my (mcg189.nat.mimos.my [10.1.18.189]) by ew.mimos.my (8.12.9p2/8.12.9) with ESMTP id iBE1it90042273 for ; Tue, 14 Dec 2004 09:44:55 +0800 (MYT) (envelope-from hasnulfadhly.h@mimos.my) Message-ID: <41BE4598.2040708@mimos.my> Date: Tue, 14 Dec 2004 09:44:56 +0800 From: Hasnul Fadhly bin Hasan User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Trying to create multi db query in one large queries Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.073 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200412/173 X-Sequence-Number: 9548 Hi, I am not sure if this is the place to ask this question, but since the question is trying to improve the performance.. i guess i am not that far off. My question is if there is a query design that would query multiple server simultaneously.. would that improve the performance? To make it clear.. let's say we have 3 db servers. 1 server is just designed to take the queries while the other 2 server is the ones that actually holds the data. let's say we have a query of 'select * from customer_data' and we change it to select * from ( dblink('db1','select * from customer_data where timestamp between timestamp \'01-01-2004\' and timestamp \'06-30-2004\'') union dblink('db2','select * from customer_data where timestamp between timestamp \'01-07-2004\' and timestamp \'12-31-2004\'') ) Would the subquery above be done simultaneously by postgres before doing the end query? or would it just execute one at a time? If it does execute simultaneously.. it's possible to create code to convert normal queries to distributed queries and requesting data from multiple database to improve performance. This would be advantageous for large amount of data. Thanks, Hasnul