Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id B9E909F93E5 for ; Tue, 5 Dec 2006 23:30:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 20927-01 for ; Tue, 5 Dec 2006 23:29:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 9BA2B9F93E2 for ; Tue, 5 Dec 2006 23:29:57 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id kB63TrRV017475; Tue, 5 Dec 2006 22:29:53 -0500 (EST) To: Tobias Brox cc: pgsql-performance@postgresql.org Subject: Re: max/min and index usage In-reply-to: <20061206030156.GA29255@oppetid.no> References: <20061206030156.GA29255@oppetid.no> Comments: In-reply-to Tobias Brox message dated "Wed, 06 Dec 2006 04:01:56 +0100" Date: Tue, 05 Dec 2006 22:29:53 -0500 Message-ID: <17474.1165375793@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/102 X-Sequence-Number: 22158 Tobias Brox writes: > We're using 8.1 - I thought such a construct was safe in pg 8.1: > select max(indexed_value) from huge_table; > while earlier we had to use: > select indexed_value from huge_table order by indexed_value desc limit 1; These are not actually exactly the same thing. In particular, I suppose your table contains a lot of nulls? regards, tom lane