Re: Primary/Foreign Keys

Поиск
Список
Период
Сортировка
От Dante torio
Тема Re: Primary/Foreign Keys
Дата
Msg-id SNT103-W203E365010ACA7E2894D07E25F0@phx.gbl
обсуждение исходный текст
Список pgsql-novice
Hi,

I am a novice PG user. I would like to know which among these data types are best suited to be used as Primary/Foreign Keys. Some of my assessment follows;

SERIAL autonumber. 

auto generated in postgres, but not when you use ODBC (i.e. MS Access as a frontend). When using it in another table as foreign key you have to know which number corresponds to which. Once the sequence is accidentally altered, an extra manipulation is needed (setval, etc)

INTEGER

More flexible than SERIAL autonumber but similarly you have to know the exact number in the parent table when filling the child table. Plus you enter the numbers manually.

VARCHAR/CHAR

use of codes alphanumeric is easier to remenber but some argues it will degrade query performance.

Some expert advise please. If this is not the proper place to ask these questions then please point me to a proper forum.

Thanks

Dante

Make the most of what you can do on your PC and the Web, just the way you want. Windows Live

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

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: Transform table data
Следующее
От: Jana
Дата:
Сообщение: Custom sorting