Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id B6C879FA4B6 for ; Mon, 15 Jan 2007 06:38:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 21850-02 for ; Mon, 15 Jan 2007 06:38:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from lists.commandprompt.com (host-254.commandprompt.net [207.173.203.254]) by postgresql.org (Postfix) with ESMTP id 6C6F99FA3B3 for ; Mon, 15 Jan 2007 06:38:33 -0400 (AST) Received: from perhan.alvh.no-ip.org (200-126-100-202.bk7-dsl.surnet.cl [200.126.100.202]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id l0FAcKLT022775; Mon, 15 Jan 2007 02:38:21 -0800 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 2BEE132A05; Mon, 15 Jan 2007 07:38:09 -0300 (CLST) Date: Mon, 15 Jan 2007 07:38:09 -0300 From: Alvaro Herrera To: Luke Lonergan Cc: Adam Rich , "Joshua D. Drake" , Tom Lane , "Craig A. James" , PostgreSQL Performance Subject: Re: max() versus order/limit (WAS: High update Message-ID: <20070115103809.GI7233@alvh.no-ip.org> Mail-Followup-To: Luke Lonergan , Adam Rich , "Joshua D. Drake" , Tom Lane , "Craig A. James" , PostgreSQL Performance References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: ClamAV version 0.88.5, clamav-milter version 0.88.5 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Mon, 15 Jan 2007 02:38:25 -0800 (PST) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/232 X-Sequence-Number: 22833 Luke Lonergan wrote: > Adam, > > This optimization would require teaching the planner to use an index for > MAX/MIN when available. It seems like an OK thing to do to me. This optimization already exists, albeit for queries that use a single table. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support