pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rod Taylor <rbt@rbt.ca>
To: rj@last.fm
Cc: PgSQL Performance ML <pgsql-performance@postgresql.org>
Subject: Re: Selecting random rows efficiently
Date: Sat, 30 Aug 2003 14:01:58 +0000
Message-ID: <1062252117.83670.29.camel@jester> (raw)
In-Reply-To: <200308301425.51127.rj@last.fm>
References: <Pine.BSF.4.44.0308300905390.829-100000@torgo.978.org>
	<200308301425.51127.rj@last.fm>

> 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.

Attachments:

  signature.asc (application/pgp-signature, 186B) download

view thread (10+ messages)  latest in thread

Message-ID: <1062252117.83670.29.camel@jester>
Permalink:  ../1062252117.83670.29.camel@jester/
Also on:    postgresql.org/message-id/1062252117.83670.29.camel@jester

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: rbt@rbt.ca, rj@last.fm
  Subject: Re: Selecting random rows efficiently
  In-Reply-To: <1062252117.83670.29.camel@jester>
  References: <Pine.BSF.4.44.0308300905390.829-100000@torgo.978.org> <200308301425.51127.rj@last.fm> <1062252117.83670.29.camel@jester>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox