Received: from noao.edu (noao.edu [140.252.1.54]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eADHEHs81166 for ; Mon, 13 Nov 2000 12:14:17 -0500 (EST) (envelope-from swampler@noao.edu) Received: from reynaud.tuc.noao.edu (reynaud.tuc.noao.edu [140.252.38.6]) by noao.edu (8.9.3/8.8.8/SAG-27Sep99) with ESMTP id KAA22655 for ; Mon, 13 Nov 2000 10:13:08 -0700 (MST) (envelope-from swampler@noao.edu) Received: from noao.edu by reynaud.tuc.noao.edu (8.9.3+Sun/SMI-SVR4-SAG05) id KAA14348; Mon, 13 Nov 2000 10:13:08 -0700 (MST) Message-ID: <3A102122.33733FF1@noao.edu> Date: Mon, 13 Nov 2000 10:13:06 -0700 From: Steve Wampler Organization: National Solar Observatory X-Mailer: Mozilla 4.7 [en] (X11; I; SunOS 5.8 sun4u) X-Accept-Language: en MIME-Version: 1.0 To: postgres-sql Subject: Using a postgres table to maintain unique id? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200011/92 X-Sequence-Number: 123 Hi, I have a distributed application that needs unique 64-bit "id" values. The current implementation keeps the current value for this id in a file on one system and uses a process to provide access to this file via CORBA. 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). 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? Any tips on how to implement the trigger would be appreciated. (Is it possible to generate an int8 sequence value?) Thanks! -- Steve Wampler- SOLIS Project, National Solar Observatory swampler@noao.edu