Re: Optimizing maximum/minimum queries (yet again) - Mailing list pgsql-hackers

From Neil Conway
Subject Re: Optimizing maximum/minimum queries (yet again)
Date
Msg-id 42575EA8.7030302@samurai.com
Whole thread Raw
In response to Re: Optimizing maximum/minimum queries (yet again)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Optimizing maximum/minimum queries (yet again)
List 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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATCHES] DELETE ... USING
Next
From: Tom Lane
Date:
Subject: Re: Optimizing maximum/minimum queries (yet again)