Thread: Limit with serial

Limit with serial

From
Eduardo Vázquez Rodríguez
Date:

Hi I create a field this way
id_log serial NOT NULL

But my records will increment aproximately 500, 000 everyday

What is the maximum number of serial permits?

The type of my serial is int4.

Thanks in advanced

Re: Limit with serial

From
Lynna Landstreet
Date:
on 7/9/04 1:32 PM, Eduardo Vázquez Rodríguez at evazquez@insys-corp.com.mx
wrote:

> Hi I create a field this way
> id_log serial NOT NULL
>
> But my records will increment aproximately 500, 000 everyday
>
> What is the maximum number of serial permits?
>
> The type of my serial is int4.
>
> Thanks in advanced

Wow, a question *I* can actually answer! :-)

According to the table of numeric data types in the PostgreSQL 7.4 docs
(http://www.postgresql.org/docs/7.4/interactive/datatype.html#DATATYPE-NUMER
IC-TABLE), the range for int4 is -2,147,483,648 to +2,147,483,647. So if
you're adding 500,000 new rows every day, you will hit the limit after 4295
days, or a little less than 12 years.

If you expect to be using this database longer than that, go with int8
instead.


Lynna

--
Resource Centre Database Coordinator
Gallery 44: www.gallery44.org
Database Project: www.gallery44db.org