Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id eAL3Hls56014 for ; Mon, 20 Nov 2000 22:17:47 -0500 (EST) (envelope-from pgsql-sql-owner@postgresql.org) Received: from mailout01.sul.t-online.com (mailout01.sul.t-online.com [194.25.134.80]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eADJFss89085 for ; Mon, 13 Nov 2000 14:15:55 -0500 (EST) (envelope-from M.Feldtmann@t-online.de) Received: from fwd04.sul.t-online.com by mailout01.sul.t-online.com with smtp id 13vP3q-0005qB-0D; Mon, 13 Nov 2000 20:14:34 +0100 Received: from toppoint.de (320064107072-0001@[193.159.25.230]) by fwd04.sul.t-online.com with esmtp id 13vP3j-1cdckyC; Mon, 13 Nov 2000 20:14:27 +0100 Message-ID: <3A104CA9.6E313C9F@toppoint.de> Date: Mon, 13 Nov 2000 20:18:49 +0000 From: M.Feldtmann@t-online.de (Marten Feldtmann) Reply-To: marten@toppoint.de X-Mailer: Mozilla 4.7 [de] (WinNT; I) X-Accept-Language: de MIME-Version: 1.0 To: Steve Wampler CC: Poet/Joshua Drake , postgres-sql Subject: Re: Using a postgres table to maintain unique id? References: <3A102875.C545E345@noao.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Sender: 320064107072-0001@t-dialin.net X-Archive-Number: 200011/163 X-Sequence-Number: 194 Steve Wampler schrieb: > > Poet/Joshua Drake wrote: > ? > ? ?However, I also use Postgres (7.0.2) throughout this > ? ?application and it seems cleaner to me to keep the current > ? ?id value in a table and just use postgres to provide access > ? ?(with a trigger function to increment the id on access). > ? > ? Why not a sequence? > > Can someone show me how to create (and use) an int8 sequence? > > ? ?Is this reasonable? Is it fast? (I need 10 or more IDs > ? ?generated each second.) Can I avoid having the table > ? ?gradually fill with "old" rows for this entry, and this > ? ?avoid the need to run VACUUM ANALYZE periodically? Throw away all the "hardwired"-stuff and do it with software. I once described an algorithm in one of this lists how to create unique values for clients without minimum interaction with the database. The result: query once in the beginning of your application, generate your id's "offline" at the maximum speed you may have and store your last generated id when your client finished. Superior to all the "hardwired"-database solutions ! Marten