Re: randomized order in select?

From: Enver ALTIN <enver(dot)altin(at)frontsite(dot)com(dot)tr>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: randomized order in select?
Date: 2004-03-10 23:15:22
Message-ID: 1078960521.31720.1.camel@enver.office.frontsite.com.tr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, 2004-03-10 at 13:02 -0600, Bruno Wolff III wrote:
> You can but it won't be very efficient (for large tables) as it will generate
> a random ordering for the whole table, probably do a sort and then return the
> first record. The only thing different you need to do is add () after random:
> select tiptext from tips order by random() limit 1

Thanks. The whole table consists of about 100 rows and I don't think it
will grow by, even twice. So this fits my needs just well.
--
__________
| |
| | Enver ALTIN (a.k.a. skyblue)
| | Software developer, IT consultant
| FRONT |
|==========| FrontSITE Bilgi Teknolojisi A.Ş.
|_____SITE_| http://www.frontsite.com.tr/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message azwa 2004-03-11 01:51:08 Re: designer tool connect to PostgreSQL
Previous Message Daniel Henrique Alves Lima 2004-03-10 23:00:14 About pg_dump