Subject Re: [ib-support] Foreign Keys
Author Helen Borrie
At 11:17 AM 22/03/2003 -0300, you wrote:
>Hi,
>
>Is there any plans to solve the problem of low selectivity on indexes
>created by foreign keys in FB?

Foreign key indexes, per se, don't intrinsically have a problem of low
selectivity. However, if you put a foreign key (or any type of index that
is non-unique) on a column whose range of possible values is small, then
you will get high distribution of few values, resulting in low selectivity.

This is usually simple to solve, by making it a rule not to make
single-column indices on such columns and not to make them foreign
keys. The need for referential integrity on this type of key (which is
usually a stable lookup table) usually can (and should) be "designed out"
by adhering to the practice that you never allow client applications to
change the referenced primary key; and that referenced rows in stable
lookup tables are never deleted. If you need ref. integrity on such keys,
it's often a sign of a mistake in the data design. You do have the option
of writing your own RI triggers if you can't do without it.

>Does this problem will be solved in FB 1.5 final release?

A lot of optimization is going on. You need to ask this sort of thing in
firebird-devel. It's not a support question.

heLen