Joseph Shraibman wrote:
> Is there a way to get random rows besides ORDER BY random()?  The problem with ORDER 
> BY 
> random() is that is has to get all the rows from the table before the results are 
> returned.

Yes, I think one person's idea was to assign a unique value to every
row, then do:

        WHERE col > random()
        ORDER BY col
        LIMIT 1

or something like that.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  [EMAIL PROTECTED]               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to