Re: Do I need a PK on a join table?

From: Knut Stolze <stolze_at_de.ibm.com>
Date: Thu, 16 Feb 2006 09:24:59 +0100
Message-ID: <dt1csr$bvu$1_at_lc03.rz.uni-jena.de>


Bob Badour wrote:

> Knut Stolze wrote:
>

>> Bob Badour wrote:
>>>Knut Stolze wrote:

> >>
>>>In DB2, a primary key mixes two logical constraints (candidate key,
>>>uniqueness) with a physical structure (index).
>> 
>> No, not really.  Granted, DB2 creates a unique index to support the
>> primary key/unique constraint.

>
> In other words, not really but, yes, exactly.

Well, you have to use _some_ mechanism on the internal layer to support the logical constructs on the conceptual layer. Still, I would consider both things as quite distinct.

>>>In DB2, uniqueness and candidate key are two logical constraints instead
>>>of one due to the abominable NULL.
>> 
>> With "uniqueness" your are referring to unique indexes not unique
>> constraints, right?

>
> Uniqueness is a logical constraint. Why one earth would you assume I
> refer to a physical structure???

Because you are mixing these two things all the time. A unique constraint is the same as a candidate key. So you can possibly only have referred to a unique index as those behave differently with respect to NULLs - which I don't like either as you have seen.

>>>>>If you have a strong argument for wanting no index, declare a
>>>>>uniqueness constraint.
>>>>
>>>>Which will be enforced by a unique index...
>>>
>>>In that case, DB2 forces one to have an index when one has a strong
>>>argument for not wanting it. That seems rather stupid to me.
>> 
>> Sure.  But how "strong" could such an argument possibly be?

>
> By definition, strong enough to make forcing an index simply wrong.
> Would it help if I typed slower?

It would help if you could actually provide an example. But I guess that's due to the "theory" part of the group.

-- 
Knut Stolze
DB2 Information Integration Development
IBM Germany
Received on Thu Feb 16 2006 - 09:24:59 CET

Original text of this message