Subject Re: [firebird-support] Re: what kind of primary key?
Author Helen Borrie
At 01:11 PM 11/02/2004 +0000, you wrote:
>--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
>wrote:
> > Have you considered using a single-column GUID? Totally random and
>unique.
>
>Yes, I have. The problem is, that indices are limited concerning the
>length of values. In my db I have many tables which describe m:n
>relations and firebird doesn't allow me to add a unique index over
>two foreign keys, then.

I don't get what you mean here: many:many? Could you explain why you think
Fb couldn't give you unique index over two foreign keys, if you wanted it
for an intersection table?

>So I think I will go back to the compound PK idea.
>Or don't you mind if you can't create an unique index for such a
>case.

Do you mean, create a separate surrogate PK for the intersection table and
control the uniqueness of the foreign key pairs using manual triggers, to
avoid having the primary key index interfering with the two foreign key
indexes? If so, I agree it's an issue you would want to test, from a
performance POV, and compare with the performance of the natural PK
compounded over the four columns.

>Remember, compound primary keys are not possible, either.

I don't remember. Why?

Helen