Re: which type for primary key?

From: Tomasz Myrta <jasiek(at)klaster(dot)net>
To: Rafal Kedziorski <rafcio(at)polonium(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: which type for primary key?
Date: 2003-02-11 10:55:16
Message-ID: 3E48D694.4050702@klaster.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Alexander Stanier 2003-02-11 13:08:09 Referential Integrity
Previous Message Alexander Stanier 2003-02-11 10:02:47 Re: On delete cascade not working