Re: Data type to use for primary key

Поиск
Список
Период
Сортировка
От Alexandre Leclerc
Тема Re: Data type to use for primary key
Дата
Msg-id 1dc7f0e304112215265f6ba487@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Data type to use for primary key  (Pierre-Frédéric Caillaud<lists@boutiquenumerique.com>)
Список pgsql-performance
Mr Caillaud,

Merci! Many points you bring were also my toughts. I was asking myself
really this was the way to go. I'm happy to see that my view of the
problem was good.

Encore merci! (Thanks again!)

On Tue, 23 Nov 2004 00:06:13 +0100, Pierre-Frédéric Caillaud
<lists@boutiquenumerique.com> wrote:
>
> > What is the common approach? Should I use directly the product_code as
> > my ID, or use a sequantial number for speed? (I did the same for the
> > company_id, this is a 'serial' and not the shor name of the customer.
> > I just don't know what is usually done.
>
>         Use a serial :
>         - you can change product_code for a product easily
>         - you can pass around integers easier around, in web forms for instance,
> you don't have to ask 'should I escape this string ?'
>         - it's faster
>         - it uses less space
>         - if one day you must manage products from another source whose
> product_code overlap yours, you won't have problems
>         - you can generate them with a serial uniquely and easily
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match
>


--
Alexandre Leclerc

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

Предыдущее
От: Pierre-Frédéric Caillaud
Дата:
Сообщение: Re: scalability issues on win32
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Data type to use for primary key