Re: which type for primary key? - Mailing list pgsql-sql

From Tomasz Myrta
Subject Re: which type for primary key?
Date
Msg-id 3E48D694.4050702@klaster.net
Whole thread Raw
In response to which type for primary key?  (Rafal Kedziorski <rafcio@polonium.de>)
List pgsql-sql
Rafal Kedziorski wrote:
> Hi,
> 
> I'm working on J2EE project with PostgreSQL (7.3.2). I know, that a 
> number type is better for primary key as string. I want create primary 
> keys as NUMBER(20). Is this a good idea? what will be a performance for 
> this length?

Postgresql documentation 5.1.2:
"However, the numeric type is very slow compared to the floating-point types described in the next section"
I'm not sure, but number(20) is 10 or 20 bytes length (you need to check this),
which is rather long variable for primary key.

I use always int4 or int8 for primary keys when possible.

Regards,
Tomasz Myrta



pgsql-sql by date:

Previous
From: "Alexander Stanier"
Date:
Subject: Re: On delete cascade not working
Next
From: Héctor Iturre
Date:
Subject: Problems with Transactions