Re: Optimizing maximum/minimum queries (yet again)

From: Neil Conway <neilc(at)samurai(dot)com>
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 04:48:40
Message-ID: 42575EA8.7030302@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> All that this optimization might do is to further cut the fraction of
> table rows at which the volatile function actually gets checked. So
> I'm not seeing that it would break any code that worked reliably before.

Hmm; what about

SELECT min(x), min(x) FROM tab WHERE random() > 0.5;

Applying the optimization would mean the two min(x) expressions would
likely be different, which seems rather weird.

> Still, if it makes you feel at all uncomfortable, we can just refuse
> the optimization in such cases.

I'd say that's probably safest.

-Neil

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-04-09 04:57:11 Re: Optimizing maximum/minimum queries (yet again)
Previous Message Tom Lane 2005-04-09 04:46:51 Re: [PATCHES] DELETE ... USING