Subject | Re: [ib-support] OT? Surrogate Keys |
---|---|
Author | Doug Chamberlin |
Post date | 2002-01-03T22:51:58Z |
At 01/03/2002 05:39 PM (Thursday), sugi wrote:
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.
>At this point I cannot decide which approach is 'better'. The majorI happen to think what you call surrogate keys are always a good idea.
>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 ?".
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.