Re: which type for primary key?

Поиск
Список
Период
Сортировка
От Tomasz Myrta
Тема Re: which type for primary key?
Дата
Msg-id 3E48D694.4050702@klaster.net
обсуждение исходный текст
Ответ на which type for primary key?  (Rafal Kedziorski <rafcio@polonium.de>)
Список 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 по дате отправления:

Предыдущее
От: "Alexander Stanier"
Дата:
Сообщение: Re: On delete cascade not working
Следующее
От: Héctor Iturre
Дата:
Сообщение: Problems with Transactions