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 058413A5FDE for ; Thu, 13 Jan 2005 20:02:50 +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 98131-07 for ; Thu, 13 Jan 2005 20:02:34 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 5938C3A5FFB for ; Thu, 13 Jan 2005 20:02:33 +0000 (GMT) Received: (qmail 4329 invoked by uid 500); 13 Jan 2005 20:16:24 -0000 Date: Thu, 13 Jan 2005 14:16:24 -0600 From: Bruno Wolff III To: =?iso-8859-1?Q?K=D6PFERL?= Robert Cc: "'pgsql-sql@postgresql.org'" Subject: Re: Column with recycled sequence value Message-ID: <20050113201624.GA3418@wolff.to> Mail-Followup-To: =?iso-8859-1?Q?K=D6PFERL?= Robert , "'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.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/85 X-Sequence-Number: 19873 On Thu, Jan 13, 2005 at 18:08:20 +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? > > I already defined a sequence but then? It is possible to let sequences roll over. One possible solution is to just try to do inserts with the sequence id and have the application retry when this fails. If the records being kept are almost all recent ones, this should work pretty well.