Re: Selecting random rows efficiently - Mailing list pgsql-performance

From Rod Taylor
Subject Re: Selecting random rows efficiently
Date
Msg-id 1062252117.83670.29.camel@jester
Whole thread Raw
In response to Re: Selecting random rows efficiently  (Richard Jones <rj@last.fm>)
Responses Re: Selecting random rows efficiently  (Ron Johnson <ron.l.johnson@cox.net>)
List pgsql-performance
> i was hoping there was some trickery with sequences that would allow me to
> easily pick a random valid sequence number..?

I would suggest renumbering the data.

ALTER SEQUENCE ... RESTART WITH 1;
UPDATE table SET pkey = DEFAULT;

Of course, PostgreSQL may have trouble with that update due to
evaluation of the unique constraint immediately -- so drop the primary
key first, and add it back after.

Attachment

pgsql-performance by date:

Previous
From: Rod Taylor
Date:
Subject: Re: Hardware recommendations to scale to silly load
Next
From: Ron Johnson
Date:
Subject: Re: Selecting random rows efficiently