Re: Primary/Foreign Keys

From: Dante torio <dantorio_ayn(at)hotmail(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Primary/Foreign Keys
Date: 2009-05-15 12:33:48
Message-ID: SNT103-W203E365010ACA7E2894D07E25F0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-novice


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)


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.


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


NEW! Get Windows Live FREE.

Browse pgsql-novice by date

  From Date Subject
Next Message Jana 2009-05-16 17:54:34 Custom sorting
Previous Message A. Kretschmer 2009-05-15 11:52:03 Re: Transform table data