Re: selecting random rows - Mailing list pgsql-general

From Tom Lane
Subject Re: selecting random rows
Date
Msg-id 4526.1063330459@sss.pgh.pa.us
Whole thread Raw
In response to selecting random rows  (Joseph Shraibman <jks@selectacast.net>)
List pgsql-general
Joseph Shraibman <jks@selectacast.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

pgsql-general by date:

Previous
From: Joseph Shraibman
Date:
Subject: Re: NFS performance tuning
Next
From: Bruno Wolff III
Date:
Subject: Re: Function to convert