Subject Re: [firebird-support] DDL for graph edges
Author Michael Ludwig
Doug Chamberlin schrieb am 03.05.2010 um 09:19:19 (-0400):
[Re: [firebird-support] DDL for graph edges]

> On 5/3/2010 3:34 AM, Michael Ludwig wrote:
> >
> > What about the PRIMARY KEY( a, b ) ? It looks okay to me, but I'm
> > reading in Helen's book (on p.274) advice against compound primary
> > keys in Firebird.

> I think her caution relates to long compound keys (that people
> sometimes create for other RDBMS). Creating a single PRIMARY KEY (A,B)
> is fine. Firebird will use it when it knows the A value so there is no
> need for a separate index on A. Having that primary key also gets you
> a unique constraint on A+B as an important by product.

That's a big part of why I like this primary key!

> You can then add just the index on B which would be useful for
> searching/joining when only the B value was known.

In fact, with foreign key constraints on both A and B, I already have an
index for B :-)

> Surrogate keys are best as replacements for those long compound keys
> mentioned earlier. You do not have those so I would advise keeping it
> simpler without a surrogate key.

Thanks for kindly sharing your advice.

Michael Ludwig