Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 8F844B5DC0D for ; Thu, 26 May 2011 14:00:51 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 29151-08 for ; Thu, 26 May 2011 17:00:44 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 4FBC0B5DBF7 for ; Thu, 26 May 2011 14:00:43 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p4QH0hFh025772; Thu, 26 May 2011 13:00:43 -0400 (EDT) To: Dave Johansen cc: pgsql-performance Subject: Re: LIMIT and UNION ALL In-reply-to: References: Comments: In-reply-to Dave Johansen message dated "Thu, 26 May 2011 09:21:45 -0700" Date: Thu, 26 May 2011 13:00:43 -0400 Message-ID: <25771.1306429243@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201105/381 X-Sequence-Number: 43890 Dave Johansen writes: > ... So is there a way to make the > planner perform the same sort of operation and push those same constraints > into the sub-queries on its own? No. As was mentioned upthread, there is a solution for this in 9.1, although it doesn't work in exactly the way you suggest. regards, tom lane