X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 759E83A5F8A for ; Thu, 13 Jan 2005 19:49:17 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95571-03 for ; Thu, 13 Jan 2005 19:49:04 +0000 (GMT) Received: from smtp102.rog.mail.re2.yahoo.com (smtp102.rog.mail.re2.yahoo.com [206.190.36.80]) by svr1.postgresql.org (Postfix) with SMTP id 936943A5F46 for ; Thu, 13 Jan 2005 19:49:02 +0000 (GMT) Received: from unknown (HELO phlogiston.dydns.org) (a.sullivan@rogers.com@216.75.167.195 with login) by smtp102.rog.mail.re2.yahoo.com with SMTP; 13 Jan 2005 19:49:01 -0000 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id B9BA64035; Thu, 13 Jan 2005 14:49:00 -0500 (EST) Date: Thu, 13 Jan 2005 14:49:00 -0500 From: Andrew Sullivan To: "'pgsql-sql@postgresql.org'" Subject: Re: Column with recycled sequence value Message-ID: <20050113194900.GB31858@phlogiston.dyndns.org> Mail-Followup-To: "'pgsql-sql@postgresql.org'" References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/86 X-Sequence-Number: 19874 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@crankycanuck.ca The plural of anecdote is not data. --Roger Brinner