From: | "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> |
---|---|
To: | <ktm(at)rice(dot)edu>,"David Johnston" <polobo(at)yahoo(dot)com> |
Cc: | "'Florian Schoppmann'" <Florian(dot)Schoppmann(at)emc(dot)com>, "'Robert Haas'" <robertmhaas(at)gmail(dot)com>, <pgsql-hackers(at)postgresql(dot)org>,"'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: Invalid optimization of VOLATILE function in WHERE clause? |
Date: | 2012-09-19 21:51:20 |
Message-ID: | 5059F808020000250004A53C@gw.wicourts.gov |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
"David Johnston" <polobo(at)yahoo(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | David Johnston | 2012-09-19 21:59:28 | Re: Invalid optimization of VOLATILE function in WHERE clause? |
Previous Message | David Johnston | 2012-09-19 21:38:16 | Re: Invalid optimization of VOLATILE function in WHERE clause? |