From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | "Randal L(dot) Schwartz" <merlyn(at)stonehenge(dot)com> |
Cc: | Ryan Mahoney <ryan(at)paymentalliance(dot)net>, PostgreSQL general list <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Randomize Result Set Order |
Date: | 2001-09-28 19:53:30 |
Message-ID: | 200109281953.f8SJrU714614@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> >>>>> "Ryan" == Ryan Mahoney <ryan(at)paymentalliance(dot)net> writes:
>
> Ryan> Is there an easy way to randomize the order that records get returned in?
> Ryan> Don't imagine there is - but thought I'd ask ;)
>
> order by random()
>
> I even threw it into my latest Linux Magazine column, expounding the
> virtues of the official Database of RedHat.
I still haven't figured out how that function call does this trick.
My guess is that because we can order by a function, it is calling
random() for every row and just sorting on that. In normal usage, the
functionm would reference database columns.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Lamar Owen | 2001-09-28 20:05:16 | Re: postgresql.conf |
Previous Message | Bruce Momjian | 2001-09-28 19:51:40 | Re: PostgreSQL 7.1 on SMP: FreeBSD 4.3 || Linux 2.4.x? |