X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id C8DD3D1B8CE for ; Sat, 30 Aug 2003 14:02:09 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 35235-01 for ; Sat, 30 Aug 2003 11:01:38 -0300 (ADT) Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) by svr1.postgresql.org (Postfix) with ESMTP id 8A0F1D1B8AA for ; Sat, 30 Aug 2003 11:01:37 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mailav.tor1.inquent.com (Postfix) with ESMTP id B54FA1025B; Sat, 30 Aug 2003 09:53:39 -0400 (EDT) Received: from [192.168.1.200] (dyn-133-83.tor.dsl.tht.net [134.22.133.83]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 99CB41024D; Sat, 30 Aug 2003 09:53:36 -0400 (EDT) Subject: Re: Selecting random rows efficiently From: Rod Taylor To: rj@last.fm Cc: PgSQL Performance ML In-Reply-To: <200308301425.51127.rj@last.fm> References: <200308301425.51127.rj@last.fm> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-c+Z2bsX6C995OKTLxuo6" Message-Id: <1062252117.83670.29.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Sat, 30 Aug 2003 14:01:58 +0000 X-Virus-Scanned: by AMaViS perl-11 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/529 X-Sequence-Number: 3345 --=-c+Z2bsX6C995OKTLxuo6 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > i was hoping there was some trickery with sequences that would allow me t= o=20 > easily pick a random valid sequence number..? I would suggest renumbering the data. ALTER SEQUENCE ... RESTART WITH 1; UPDATE table SET pkey =3D 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. --=-c+Z2bsX6C995OKTLxuo6 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQA/UK5V6DETLow6vwwRAh9GAJsGVb68JRwuJLhhPzmmKi+HfUfsXwCfUpCu yIw1ezFFDNjlz5y0WYA1pKg= =8TSm -----END PGP SIGNATURE----- --=-c+Z2bsX6C995OKTLxuo6--