Re: Auto incrementing primary keys

From: Reid Thompson <Reid(dot)Thompson(at)ateb(dot)com>
To: rod(at)iol(dot)ie
Cc: pgsql_user <amaltasb(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Auto incrementing primary keys
Date: 2008-02-19 00:09:27
Message-ID: 1203379767.27833.5.camel@endpoint
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Mon, 2008-02-18 at 17:46 +0000, Raymond O'Donnell wrote:
> On 18/02/2008 13:14, pgsql_user wrote:
> > so wouldnt I run out of ids one day, if there are lot of failed insert
> > statements, lets say for every successful insert there are 50
> > unsuccessful inserts, so ids would be 1, 50, 100, and once I have
> > thousands of rows, I will run out of IDs ? should I use bigserial
> > instead ?
>
> Well, that depends on your usage, so only you can answer that. According
> to the docs, "serial" creates an integer column, which will give you
> 2147483647 values - how quickly will you use that lot up? If you think
> you will run out, by all means use bigserial.
>
> Ray.
>
> ---------------------------------------------------------------
> Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
> rod(at)iol(dot)ie
> ---------------------------------------------------------------
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match

http://www.google.com/search?q=2147483647+seconds+to
+years&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:official&client=firefox-a

at one per second.
2 147 483 647 seconds = 68.0511039 years

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Markus Bertheau 2008-02-19 07:17:18 out-of-line (TOAST) storage ineffective when loading from dump?
Previous Message Tom Lane 2008-02-18 22:35:10 Re: Pains in upgrading to 8.3