Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id AC1269FA17E for ; Sat, 27 Oct 2007 21:20:42 -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 60921-01 for ; Sat, 27 Oct 2007 21:20:27 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from oxford.xeocode.com (unknown [87.127.95.196]) by postgresql.org (Postfix) with ESMTP id CA83E9FA16E for ; Sat, 27 Oct 2007 21:20:31 -0300 (ADT) Received: from localhost.enta.net ([127.0.0.1] helo=oxford.xeocode.com) by oxford.xeocode.com with esmtp (Exim 4.67) (envelope-from ) id 1IlvtD-0001Do-1N; Sun, 28 Oct 2007 01:20:27 +0100 To: "Luke Lonergan" Cc: "Heikki Linnakangas" , "Anton" , Subject: Re: partitioned table and ORDER BY indexed_field DESC LIMIT 1 In-Reply-To: (Luke Lonergan's message of "Sat\, 27 Oct 2007 15\:28\:04 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-Draft-From: ("nnimap+mail01.enterprisedb.com:INBOX.performance" 2974) References: From: Gregory Stark Organization: EnterpriseDB Date: Sun, 28 Oct 2007 01:20:26 +0100 Message-ID: <87abq4ytrp.fsf@oxford.xeocode.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/328 X-Sequence-Number: 27350 "Luke Lonergan" writes: > The approach we took was to recognize the ordering of child nodes and > propagate that to the append in the special case of only one child (after > CE). This is the most common use-case in 'partitioning', and so is an easy, > high payoff low amount of code fix. Ah yes, we should definitely try to prune singleton append nodes. On a lark I had tried to do precisely that to see what would happen but ran into precisely the problem you had to solve here with your pullup_vars function. That's one of the functions which wasn't included in the original patch so I'll look at the patch from the queue to see what's involved. Actually currently it's not a common case because we can't eliminate the parent partition. I have some ideas for how to deal with that but haven't written them up yet. In theory if we can preserve ordering across append nodes there's no good reason to prune them. But generally I think simplifying the plan is good if only to present simpler plans to the user. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com