On Tue, 2006-10-10 at 00:13 +0200, Christian Ulrich wrote:
> Joost van der Sluis schrieb:
> > On Mon, 2006-10-09 at 20:55 +0200, Vincent Snijders wrote:
> >   
> >> Christian Ulrich wrote:
> >>     
> >>>> Multiple-fields-primary keys, for 
> >>>> example, I consider as a bad design. (I can imagine some 
> >>>> exceptions, but those are really rare) 
> >>>>         
> >>> Why ? I have at example an article table wher the primary key consists
> >>> of 
> >>> article number + version + language
> >>>
> >>> Why an primary key that consists of these 3 fields is not an good idea
> >>> ??
> >>>
> >>>       
> >> Because if you want to use that article in order item table or a bill of 
> >> materials table, you need to add 3 fields as foreign key.
> >>     
> how you select one version from another in the orders table when you 
> havend an field for that
> i must add always all 3 fields

I don't say that it isn't usefull here. I have no clue what you're doing
with that table. I only try to explain the bigger picture.

> and an primary key is for me the security that the article number or 
> these article dont exist twice
> and my data is corrupted, that hasend to do somethig with indexes
> data integrity comes first for me then comes speed maybe an index with 3 
> fields makes no sense
> but an key ...

Add a primary key, and add an index on the three fields which doesn't
allow double values. Such a restriction isn't restricted to primary
keys. So your data-integrity doesn't come in danger. 

> and i can also specify secondary indexes on fields in an primary key 
> cant i ?!

Yes, but it wil map that secondary index on the primary index, which is
big, since it contains three fields-> inefficient. You could better do
it the other way around.

Joost

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to