Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 3D5B49FB791 for ; Mon, 30 Apr 2007 16:19:27 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 25488-02 for ; Mon, 30 Apr 2007 16:19:20 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from oxford.xeocode.com (unknown [87.127.95.194]) by postgresql.org (Postfix) with ESMTP id 8301D9FB797 for ; Mon, 30 Apr 2007 16:19:23 -0300 (ADT) Received: from localhost.enta.net ([127.0.0.1] helo=oxford.xeocode.com) by oxford.xeocode.com with esmtp (Exim 4.63) (envelope-from ) id 1HibP2-0000uT-JT; Mon, 30 Apr 2007 20:19:16 +0100 From: Gregory Stark To: "Andreas Haumer" Cc: "Tom Lane" , Subject: Re: Query performance problems with partitioned tables In-Reply-To: <46362571.20301@xss.co.at> (Andreas Haumer's message of "Mon, 30 Apr 2007 19:20:49 +0200") Organization: EnterpriseDB References: <4635D678.3050205@xss.co.at> <27303.1177945607@sss.pgh.pa.us> <46362571.20301@xss.co.at> X-Draft-From: ("nnimap+mail01.enterprisedb.com:INBOX.performance" 122) Date: Mon, 30 Apr 2007 20:19:16 +0100 Message-ID: <87lkg9r7pn.fsf@oxford.xeocode.com> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/513 X-Sequence-Number: 24390 Wait, rereading the original queries I seem to have misunderstood something. The individual parts of the partitioned tables are being accessed in timestamp order. So what's missing is some way for the optimizer to know that the resulting append results will still be in order. If it knew that all the constraints were mutually exclusive and covered ascending ranges then it could avoid doing the extra sort. Hm... -- Gregory Stark EnterpriseDB http://www.enterprisedb.com