Subject | When to mark as foreign key or not? |
---|---|
Author | dhay@lexmark.com |
Post date | 2003-10-23T21:28:05Z |
Hi,
I have a forms table, a categories table, and a formcategory table which
links the form with the categories it is in.
I automatically set the form_id and category_id in the formcategory table
(that's all it contains) as foreign keys to forms.id and categories.id
respectively. However this automatically creates an index on category_id,
but with a selectivity of 100.
So...will this be problematic in terms of the optimizer? Should I handle
the foreign key stuff myself? It seems like the right thing to
do...but???!
Any advice appreciated,
Cheers,
David
I have a forms table, a categories table, and a formcategory table which
links the form with the categories it is in.
I automatically set the form_id and category_id in the formcategory table
(that's all it contains) as foreign keys to forms.id and categories.id
respectively. However this automatically creates an index on category_id,
but with a selectivity of 100.
So...will this be problematic in terms of the optimizer? Should I handle
the foreign key stuff myself? It seems like the right thing to
do...but???!
Any advice appreciated,
Cheers,
David