serial = autoincrement = without gaps ??

From: go_speedy(at)freenet(dot)de
To: pgsql-novice(at)postgresql(dot)org
Subject: serial = autoincrement = without gaps ??
Date: 2004-10-28 06:45:59
Message-ID: E1CN42p-0003m2-R6@www14.emo.freenet-rz.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,<br>
<br>
I want to use IDs in my tables which are autoincremented (by inserting new data), unique and without gaps. I figured out that the datatype serial should provide this besides the last feature. <br>
Moreover I figured out that if I use serial as datatype for my IDs it is allways increment if I insert sth., if I use nextval(...) and also if a transaction is aborted.<br>
Now if I do some inserts and deletes in my database gaps are generated because the serial is allways incremented. Am I right that there is no possibility to reset the serial-datatype or to avoid gaps without gaining problems? My problem at this is that I expect to run the database some years and I imagine that some day the serial-datatype evokes an overrun which corrupts the database.<br>
<br>
I hope you can deliver some infos that resolves my misgivings.<br>
<br>
thx janla

<br>--<br><!-- AdSpace freenet EMO Webmail Banner -->
<a href="http://adserver.freenet.de/click.ng/site=fn&prod=chetools&kat=rub&tbl=webmail&ppos=1&TransactionID=1098945959249369&rgtg=256" target="_blank"><img src="http://adserver.freenet.de/image.ng/site=fn&prod=chetools&kat=rub&tbl=webmail&ppos=1&TransactionID=1098945959249369&rgtg=256" border="0"></a><!-- / AdSpace -->

Attachment Content-Type Size
unknown_filename text/html 1.2 KB

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Oliver Fromme 2004-10-28 07:25:33 Re: serial = autoincrement = without gaps ??
Previous Message Tom Lane 2004-10-27 22:44:29 Re: Question Regarding Locks