From: | Michael Teter <michael_teter(at)yahoo(dot)com> |
---|---|
To: | Steve Wampler <swampler(at)noao(dot)edu>, Poet/Joshua Drake <poet(at)linuxports(dot)com> |
Cc: | postgres-sql <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Using a postgres table to maintain unique id? |
Date: | 2000-11-14 02:22:41 |
Message-ID: | 20001114022241.6363.qmail@web10008.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
> Can someone show me how to create (and use) an int8
> sequence?
From what I can tell (both from docs and doing a
describe on sequences in my database), a postgresql
sequence is an int4, not an int8, and thus you are
limited to a max of 2.1 billion values.
If you require an int8 sequence, you'll probably have
to manage your own and just use an int8 column.
> Fortunately, I don't want any number to ever get
> recycled - the id needs to
> be unique throughout the 25+ year lifetime of the
> project. The table
> would have a single row with a single column.
> Selecting that table cell
> would return the current value, but leave the value
> incremented in the
> table cell (it's ok if it increments the value
> before returning).
If 2.1 billion unique values is enough, then a
sequence will work fine. Performance of sequence
should be ok.
An alternative you might consider is creating your own
"sequence server" external to the database.
Michael
__________________________________________________
Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!
http://calendar.yahoo.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Philip Warner | 2000-11-14 05:30:35 | Re: how to continue a transaction after an error? |
Previous Message | Cristi Petrescu-Prahova | 2000-11-13 20:24:15 | Re: how to continue a transaction after an error? |