pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Steve Wampler <swampler@noao.edu>
To: postgres-sql <pgsql-sql@postgresql.org>
Subject: Using a postgres table to maintain unique id?
Date: Mon, 13 Nov 2000 10:13:06 -0700
Message-ID: <3A102122.33733FF1@noao.edu> (raw)


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



view thread (11+ messages)  latest in thread

Message-ID: <3A102122.33733FF1@noao.edu>
Permalink:  ../3A102122.33733FF1@noao.edu/
Also on:    postgresql.org/message-id/3A102122.33733FF1@noao.edu

 · 

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-sql@postgresql.org
  Cc: swampler@noao.edu
  Subject: Re: Using a postgres table to maintain unique id?
  In-Reply-To: <3A102122.33733FF1@noao.edu>
  References: <3A102122.33733FF1@noao.edu>

* 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