Re: Column with recycled sequence value

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Column with recycled sequence value
Date: 2005-01-13 19:49:00
Message-ID: 20050113194900.GB31858@phlogiston.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, Jan 13, 2005 at 06:08:20PM +0100, KÖPFERL Robert wrote:
> Hi,
>
> suppose I have a let's say heavy used table. There's a column containing
> UNIQUE in4
> values. The data type musn't exceed 32-Bit. Since however the table is heavy
> used 2^32 will be reached soon and then? There are far less than 4G-records
> saved thus these values may be reused. How can this be accomplished?

You can set the sequence up to cycle (so once it gets to the end, it
wraps around to the beginning again). The keyword is CYCLE at CREATE
SEQUENCE time. It defaults to NO CYCLE.

One potential problem, of course, are collisions on the table,
because some value wasn't cleared out. It sounds like you don't have
that problem though.

A

--
Andrew Sullivan | ajs(at)crankycanuck(dot)ca
The plural of anecdote is not data.
--Roger Brinner

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2005-01-13 20:16:24 Re: Column with recycled sequence value
Previous Message KÖPFERL Robert 2005-01-13 17:08:20 Column with recycled sequence value