Re: Optimizing maximum/minimum queries (yet again)

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Optimizing maximum/minimum queries (yet again)
Date: 2005-04-09 02:06:22
Message-ID: 20050409020622.GB3177@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Apr 08, 2005 at 20:50:09 -0400,
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> SELECT (SELECT x FROM tab WHERE ... ORDER BY x LIMIT 1),
> (SELECT y FROM tab WHERE ... ORDER BY y DESC LIMIT 1);

> Comments? Anyone see anything I missed?

Are NULLs a problem? In the second case above, wouldn't you get NULL
instead of the value returned by max if there were some NULL and some
not NULL values?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruno Wolff III 2005-04-09 02:44:32 Re: Optimizing maximum/minimum queries (yet again)
Previous Message Bruno Wolff III 2005-04-09 02:02:17 Re: Optimizing maximum/minimum queries (yet again)