Subject Re: Index creation
Author Adam
--- In firebird-support@yahoogroups.com, Robert martin <rob@...> wrote:
>
> Hi
>
>
> I have the following table
>
> TableA
> UniqueID (primarly Key)
> FK1 (Foreign Key into another table)
> FK2 (Foreign Key into another table)
>
> We are not using Foreign keys in FB. I anticipate searching using
> 'WHERE FK1 = xx AND FK2 = xx) most of the time. However I will also be
> doing searches on each FK field individually. Should I create one
> composite index for FK1, FK2 or two individual indexs ?

Neither.

The foreign key constraint will already create an ascending index on
TableA.FK1 and an ascending index on TableA.FK2. Firebird can combine
these indices at runtime for such queries.


Adam