pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tobias Brox <tobias@nordicbet.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: max/min and index usage
Date: Tue, 05 Dec 2006 22:29:53 -0500
Message-ID: <17474.1165375793@sss.pgh.pa.us> (raw)
In-Reply-To: <20061206030156.GA29255@oppetid.no>
References: <20061206030156.GA29255@oppetid.no>

Tobias Brox <tobias@nordicbet.com> 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



view thread (4+ messages)  latest in thread

Message-ID: <17474.1165375793@sss.pgh.pa.us>
Permalink:  ../17474.1165375793@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/17474.1165375793@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, tobias@nordicbet.com
  Subject: Re: max/min and index usage
  In-Reply-To: <17474.1165375793@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox