X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 370A9D1B467 for ; Wed, 10 Mar 2004 23:14:00 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 24508-03 for ; Wed, 10 Mar 2004 19:14:00 -0400 (AST) Received: from fs.frontsite.com.tr (unknown [217.195.194.174]) by svr1.postgresql.org (Postfix) with ESMTP id 6E540D1B459 for ; Wed, 10 Mar 2004 19:13:57 -0400 (AST) Received: from skyblue.office.frontsite.com.tr (localhost [127.0.0.1]) by fs.frontsite.com.tr (8.12.3/8.12.3/Debian-6.6.1) with ESMTP id i2AN0ZLO027594 for ; Thu, 11 Mar 2004 01:00:35 +0200 Received: by skyblue.office.frontsite.com.tr (Postfix, from userid 1000) id 6A87B630B0; Thu, 11 Mar 2004 01:15:22 +0200 (EET) Subject: Re: randomized order in select? From: Enver ALTIN To: pgsql-sql@postgresql.org In-Reply-To: <20040310190250.GA6629@wolff.to> References: <1078937297.29628.12.camel@enver.office.frontsite.com.tr> <20040310190250.GA6629@wolff.to> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-bDmRymO9l08TWN6SAO/X" Organization: FrontSITE Bilgi Teknolojisi A.S. Message-Id: <1078960521.31720.1.camel@enver.office.frontsite.com.tr> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.5.5 Date: Thu, 11 Mar 2004 01:15:22 +0200 X-FrontSITE-MailScanner-Information: Please contact the ISP for more information X-FrontSITE-MailScanner: Found to be clean X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/125 X-Sequence-Number: 17224 --=-bDmRymO9l08TWN6SAO/X Content-Type: text/plain; charset=ISO-8859-9 Content-Transfer-Encoding: quoted-printable 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 gene= rate > 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 ra= ndom: > 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. --=20 __________ | | | | Enver ALTIN (a.k.a. skyblue) | | Software developer, IT consultant | FRONT | |=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D| FrontSITE Bilgi Teknolojisi A.=DE. |_____SITE_| http://www.frontsite.com.tr/ --=-bDmRymO9l08TWN6SAO/X Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQBAT6GIZCB2FZvqK0sRAlleAJwNmQqGv3gAdEFwT2tdaigsDKNmiQCfe46q sjerBMIVrh0IWTG+/Fhk6cU= =tG2O -----END PGP SIGNATURE----- --=-bDmRymO9l08TWN6SAO/X--