Subject Re: [ib-support] OT? Surrogate Keys
Author Doug Chamberlin
At 01/03/2002 05:39 PM (Thursday), sugi wrote:
>At this point I cannot decide which approach is 'better'. The major
>complaints people are having with the surrogate model is that it's
>'unusual'. Opinions/suggestions/tips or even links to appropriate
>'reading materials' will be greatly appreciated. Many thanks in advance.
>
>Salam,
>sugi.
>
>PS : I guess this can be the tip of the iceberg for bigger question,
>like "is surrogate keys ALWAYS a good idea ?".

I happen to think what you call surrogate keys are always a good idea.
Using primary keys based on application domain data values is always risky.
Users have a tendency to change those important values and then you are
faced with an annoying task of handling primary key changes which otherwise
would not be required. Using surrogate keys also helps keep index records
smaller.

We have recently built a system which uses surrogate keys extensively, all
of which are generated. One really nice by-product is that you can uniquely
identify any single record in the database by a combination of table name
and a single integer ID value. In the application code we call this a
"record reference" and pass them around as objects. Very slick. Allows you
to write some very generic code.