Re: Optimizing maximum/minimum queries (yet again)

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

Bruno Wolff III <bruno(at)wolff(dot)to> writes:
> 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);

> 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?

Hmm ... we might have to hack the LIMIT step to skip over NULLs.
Doesn't seem like an insurmountable issue though.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-04-09 03:37:53 Re: Optimizing maximum/minimum queries (yet again)
Previous Message Mark Kirkwood 2005-04-09 03:18:43 Re: Optimizing maximum/minimum queries (yet again)