Re: Varchar pkey instead of integer

Поиск
Список
Период
Сортировка
От Joshua D. Drake
Тема Re: Varchar pkey instead of integer
Дата
Msg-id 4833BE42.5030409@commandprompt.com
обсуждение исходный текст
Ответ на Varchar pkey instead of integer  ("Robins Tharakan" <tharakan@gmail.com>)
Список pgsql-performance
Robins Tharakan wrote:
> Hi,

> Now what I wanted to ask was whether its any different to have the
> primary-keys in such master tables as text/varchar rather than integer ?
> i.e. Can I use a character varying(10) and use the text 'million' /
> 'billion' instead of a serial / integer type ?

One should ask themselves why before can I. :)

If you want to use a varchar() for a primary key that is fine but make
it a natural key not an arbitrary number. If you are going to use
arbitrary numbers, use a serial or bigserial.

Joshua D. Drake


В списке pgsql-performance по дате отправления:

Предыдущее
От: "Robins Tharakan"
Дата:
Сообщение: Varchar pkey instead of integer
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: Varchar pkey instead of integer