Subject | Re: [firebird-support] Re: Foreign keys and unique indexes |
---|---|
Author | Ann W. Harrison |
Post date | 2005-05-10T19:35:21Z |
benedicte_asselin wrote:
declare a unique index (old fashioned) and the other is to declare a
unique constraint (modern SQL). The constraint causes the creation of a
unique index, for performance. In order to create a foreign key
constraint referencing a field, you must have a unique constraint - not
just an index - on that field.
And no, there's no performance penalty for declaring both constraints.
Regards,
Ann
> another question: is there a penalty if expressing both constraints?As it turns out, there are two ways to make a field unique - one is to
declare a unique index (old fashioned) and the other is to declare a
unique constraint (modern SQL). The constraint causes the creation of a
unique index, for performance. In order to create a foreign key
constraint referencing a field, you must have a unique constraint - not
just an index - on that field.
And no, there's no performance penalty for declaring both constraints.
Regards,
Ann