Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f25LNfx42569 for ; Mon, 5 Mar 2001 16:23:41 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.1/8.11.1) with ESMTP id f25LNb920857; Mon, 5 Mar 2001 16:23:37 -0500 (EST) To: Bruce Momjian cc: Jelle Ouwerkerk , pgsql-sql@postgresql.org Subject: Re: random In-reply-to: <200103052104.QAA01988@candle.pha.pa.us> References: <200103052104.QAA01988@candle.pha.pa.us> Comments: In-reply-to Bruce Momjian message dated "Mon, 05 Mar 2001 16:04:35 -0500" Date: Mon, 05 Mar 2001 16:23:37 -0500 Message-ID: <20854.983827417@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200103/64 X-Sequence-Number: 1709 Bruce Momjian writes: >> Jelle Ouwerkerk writes: > Also, is there a way to randomize the order of a result set? >> >> There's always >> SELECT * FROM foo ORDER BY random(); > However: > test=> select * from pg_class order by random(); > does return some output. Is it random, and if so, how? Sure. The function is marked noncachable, so it gets evaluated afresh at each row --- but only once per row, as the sort step doesn't recompute any values. Should work just peachy, and it seems to do so in a couple quick tests. regards, tom lane