From: Steve Wampler <swampler@noao.edu>
To: marten@toppoint.de
Cc: Poet/Joshua Drake <poet@linuxports.com>
Cc: postgres-sql <pgsql-sql@postgresql.org>
Subject: Re: Using a postgres table to maintain unique id?
Date: Mon, 13 Nov 2000 12:36:35 -0700
Message-ID: <3A1042C3.723D10DC@noao.edu> (raw)
References: <Pine.LNX.4.30.0011130925400.2094-100000@crazypenguins.commandprompt.com>
<3A102875.C545E345@noao.edu>
<3A104CA9.6E313C9F@toppoint.de>
Marten Feldtmann wrote:
>
> 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 !
Yes, but...
(1) The application I have is composed of about 50 processes
running on 3 different OS/architectures (Linux/intel,
Solaris/sparc, and VxWorks/ppc). The IDs I need must be
unique across all processes (I suppose one solution would
be to provide each ID with a unique prefix based on the
process that is running, but...)
(2) Some of these systems are real-time boxes that might get
rebooted at any moment, or might hang for hardware-related
reasons [I'd like to able to say that all of the processes
could detect imminent failure, but unfortunately, I can't].
So determining when a client "finishes" is not always possible,
which prevents (he claims) the above solution from claiming
ID uniqueness.
However, it might be sufficient to provide a process on the
postgres DB machine (if *that* machine dies, *everything* stops...)
that serves IDs via CORBA to all the other applications and
(internally) uses the "software" approach given above. This
process could "sync" with the database every N seconds or so
(where N might be < 1.0). This, while still not guaranteeing
uniqueness, would at least come pretty close... It would still be
nice to avoid having to VACUUM ANALYZE this table, though, and it
"feels" as though it is duplicating functionality already provided
by postgres DB backends.
I'll think about this solution - thanks!
--
Steve Wampler- SOLIS Project, National Solar Observatory
swampler@noao.edu
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, marten@toppoint.de, poet@linuxports.com
Subject: Re: Using a postgres table to maintain unique id?
In-Reply-To: <3A1042C3.723D10DC@noao.edu>
References: <Pine.LNX.4.30.0011130925400.2094-100000@crazypenguins.commandprompt.com> <3A102875.C545E345@noao.edu> <3A104CA9.6E313C9F@toppoint.de> <3A1042C3.723D10DC@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