From: Enver ALTIN <enver.altin@frontsite.com.tr>
To: pgsql-sql@postgresql.org
Subject: Re: randomized order in select?
Date: Thu, 11 Mar 2004 01:15:22 +0200
Message-ID: <1078960521.31720.1.camel@enver.office.frontsite.com.tr> (raw)
In-Reply-To: <20040310190250.GA6629@wolff.to>
References: <1078937297.29628.12.camel@enver.office.frontsite.com.tr>
<20040310190250.GA6629@wolff.to>
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/Attachments:
signature.asc (application/pgp-signature, 188B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: enver.altin@frontsite.com.tr
Subject: Re: randomized order in select?
In-Reply-To: <1078960521.31720.1.camel@enver.office.frontsite.com.tr>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox