Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 34AB09FBD59 for ; Thu, 3 May 2007 23:38:08 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 01899-06 for ; Thu, 3 May 2007 23:37:53 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.237]) by postgresql.org (Postfix) with ESMTP id 9BD429FB51E for ; Thu, 3 May 2007 23:37:59 -0300 (ADT) Received: by wr-out-0506.google.com with SMTP id 70so719189wra for ; Thu, 03 May 2007 19:37:58 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ZfNJmLRwjGd9e9QPe+f4Lr5RrlCnH43ZzPRcWyCE8IgtBZpmW8Y+F7tWmbqb+DQ7ixC5v6UEkljkFhlyZ05hdxvyxOUtukFtfRCo26rzELjBicRtB49jCzHpslDpOtotgVpSs/NWPDY84/Ry3O6505bOUKsw1GS334M85NwyD5k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=LEUErW7vaTyhuPRLuz+oKUWVyNzf9QIruk7e5YTEw0hGx4ZurvilnX+zGh4bFnNgPbfRgFWFSsvk0I7UPr1q/iXeb+3BpQOl7mZEZtwFveZgDVMaVDUEtXohkWVAag2rc0Mvbbw0QRvRN0Pgu/uoE78Dp3F1rDXZbACoMWq0q8g= Received: by 10.78.157.19 with SMTP id f19mr1256003hue.1178246277733; Thu, 03 May 2007 19:37:57 -0700 (PDT) Received: by 10.78.56.20 with HTTP; Thu, 3 May 2007 19:37:57 -0700 (PDT) Message-ID: Date: Fri, 4 May 2007 08:07:57 +0530 From: "Merlin Moncure" To: "Fei Liu" Subject: Re: Query performance problems with partitioned tables Cc: "Andreas Haumer" , pgsql-performance@postgresql.org In-Reply-To: <4639F97D.3080003@aepnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4635D678.3050205@xss.co.at> <4639F97D.3080003@aepnetworks.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/38 X-Sequence-Number: 24428 On 5/3/07, Fei Liu wrote: > Hello, Andreas, I too am having exactly the same issue as you do. > Comparing my partitioned and plain table performance, I've found that > the plain tables perform about 25% faster than partitioned table. Using > 'explain select ...', I see that constraints are being used so in > partitioned tables fewer rows are examined. But still partitioned tables > are 25% slower, what a let down. That's a little bit harsh. The main use of partitioning is not to make the table faster but to make the maintenance easier. When constraint exclusion works well for a particular query you can get a small boost but many queries will break down in a really negative way. So, you are sacrificing flexibility for easier maintenance. You have to really be careful how you use it. The best case for partitioning is when you can logically divide up your data so that you really only have to deal with one sliver of it at a time...for joins and such. If the OP could force the constraint exclusion (maybe by hashing the timestamp down to a period and using that for where clause), his query would be fine. The problem is it's not always easy to do that. merlin