Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 881181337BD5 for ; Fri, 29 Apr 2011 13:50:38 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 07530-01 for ; Fri, 29 Apr 2011 16:50:20 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gw.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by mail.postgresql.org (Postfix) with ESMTP id 541281337B43 for ; Fri, 29 Apr 2011 13:50:20 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Fri, 29 Apr 2011 11:50:18 -0500 Message-Id: <4DBAA5F1020000250003D061@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Fri, 29 Apr 2011 11:50:09 -0500 From: "Kevin Grittner" To: "Michiel" , Subject: Re: BUG #5997: [queryplan] PostgreSQL is sorting the query results when the result can only be 1 item. References: <201104290807.p3T872Gp079123@wwwmaster.postgresql.org> In-Reply-To: <201104290807.p3T872Gp079123@wwwmaster.postgresql.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201104/216 X-Sequence-Number: 30135 "Michiel" wrote: > [query with ORDER BY clause] > [plan which spends 0.039 ms sorting one row] > What i see and expect: > > I see that the query is sorted. But the result is max 1 item. This is not a bug; it is a feature request for the planner. If you see a way that a query can be reliably analyzed to determine that the sort can be omitted which takes less than the 0.039 ms required for the sort step, please suggest it. But not on the bugs list. -Kevin