Thread: Re: select random order by random

Re: select random order by random

From
piotr_sobolewski
Date:
On Thursday 01 November 2007 17:16, Scott Marlowe wrote:

> > > I was very surprised when I executed such SQL query (under PostgreSQL
> > > 8.2):
> > > select random() from generate_series(1, 10) order by random();
> > >
> (...)
> My guess is that it was recognized by the planner as the same function
> and evaluated once per row only.

I also had such hypothesis, but I think that query:
select random(), random() from generate_series(1, 10) order by random();
contradicts it.

--
Piotr Sobolewski
http://www.piotrsobolewski.w.pl