Re: select random order by random

From: piotr_sobolewski <piotr_sobolewski(at)o2(dot)pl>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: select random order by random
Date: 2007-11-01 18:38:22
Message-ID: 6963225.43bd0fc6.472a1d1e.29016@o2.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Browse pgsql-general by date

  From Date Subject
Next Message Kynn Jones 2007-11-01 18:57:36 Populating large DB from Perl script
Previous Message piotr_sobolewski 2007-11-01 18:37:01 Re: select random order by random