Re: selecting random rows

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joseph Shraibman <jks(at)selectacast(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: selecting random rows
Date: 2003-09-12 01:34:19
Message-ID: 4526.1063330459@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Joseph Shraibman <jks(at)selectacast(dot)net> writes:
> Is there a way to get random rows besides ORDER BY random()?

Are you willing to expend an extra column in the table, plus an index on
the column, to make this fast? Then you can do it --- see discussion
just a few days ago.
http://archives.postgresql.org/pgsql-performance/2003-08/msg00526.php

If you are willing to settle for "only approximately random", you might
be able to use the primary key as a pseudo-random value. Again, see
prior discussion.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message JoshuaF 2003-09-12 02:34:01 how can i use SELECT to find a substring of a column's data?
Previous Message Joseph Shraibman 2003-09-12 00:53:53 Re: NFS performance tuning