Re: Cascade updates on primary keys..

From: David Browne (meat_at_hotmail.com)
Date: 12/17/04


Date: Fri, 17 Dec 2004 15:29:51 -0600


"Samuel R. Neff" <blinex@newsgroup.nospam> wrote in message
news:91d6s0pdr7l99249d5nbl4nm4ku29n7433@4ax.com...
>
> When the primary key is used as a foreign key in another table, then
> the use of a compound primary key is both wasteful and
> non-normalized--it duplicates data unnecessarily.
>

It's not "non-normalized" because the rules for normalization take no notice
of whether a key is simple or compound. It just doesn't affect the
normalization.

It's not "wasteful" beacuse what you loose in storing the longer foreign key
on the table, you often make up for in having fewer total indexes on the
tables. Also it simplifies and dramatically speeds filtering the related
table by the compound key columns.

EG

   select sum(amount)
   from order_details
   where customer = 1

instead of

   select sum(amount)
   from order_details
   where order_id in ( select id
                                    from order
                                    where customer = 1)

David



Relevant Pages

  • Re: Cascade updates on primary keys..
    ... > When the primary key is used as a foreign key in another table, ... of whether a key is simple or compound. ... It's not "wasteful" beacuse what you loose in storing the longer foreign key ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Generating values as part of a compound key
    ... > BEGINNER QUESTION ... > I have a table which has a compound primary key consisting of two ...
    (comp.databases.ms-sqlserver)
  • Re: Trend towards artificial keys (GUIDs) sez my textbook...is AI next?
    ... Sometimes they conflict and one has to make tradeoffs. ... Sometimes no such ideal key exists. ... primary key that includes a PRIMARY key of the first table. ... table has a _compound_ primary key. ...
    (comp.databases.theory)
  • Re: Assign Foreign key
    ... The symbol field cannot be primary key in this table, ... I think the most likely candidate is a compound key ... A key should prevent duplicate data; ...
    (microsoft.public.access.tablesdbdesign)