Re: Invalid optimization of VOLATILE function in WHERE clause? - Mailing list pgsql-hackers

From Kevin Grittner
Subject Re: Invalid optimization of VOLATILE function in WHERE clause?
Date
Msg-id 5059F808020000250004A53C@gw.wicourts.gov
Whole thread Raw
In response to Re: Invalid optimization of VOLATILE function in WHERE clause?  ("David Johnston" <polobo@yahoo.com>)
Responses Re: Invalid optimization of VOLATILE function in WHERE clause?
List pgsql-hackers
"David Johnston" <polobo@yahoo.com> wrote:
> VOLATILE: "A Volatile function used in an ORDER BY or WHERE clause
> without referencing any columns from the query itself (i.e., no
> parameters or all constants) will be evaluated a single time and
> the result treated as a constant (i.e., all rows will have
> identical values) for that part of the query."
I hope you're wrong about the ORDER BY part of that.  A quick test
confirms that it works in ORDER BY, at least for some cases.  If
there are any exceptions to that, I would sure like to know about
it -- and really soon.
select * from generate_series(1, 10000) s(n) order by random() limit 10;
-Kevin



pgsql-hackers by date:

Previous
From: "David Johnston"
Date:
Subject: Re: Invalid optimization of VOLATILE function in WHERE clause?
Next
From: "David Johnston"
Date:
Subject: Re: Invalid optimization of VOLATILE function in WHERE clause?