Re: Index creation
Date: Fri, 09 Aug 2002 05:33:31 GMT
Message-ID: <3d5353c9.470706_at_news.aon.at>
On 8 Aug 2002 16:25:41 -0700, flaviorm_at_portoweb.com.br (=?ISO-8859-1?Q?Fl=E1vio_Maciel?=) wrote:
>Consider a basic many-to-many relationship where you have two foreign
>keys that are also the primary key of this relationship table.
>My question is: what's are the differences and implications of:
>- building an index for the primary key and each foreign key?
>- building an index just for thew primary key?
>- building an index just for the foreign keys?
>
>If I have the index for the primary key, is it needed to have indexes
>for each foreign key individually?
I think with the most of the common DBMSes, you won't need three indices. Say the foreign keys are A and B, you have the primary key index (A, B). Then you only need another index on B, since the primary key index can be used for matching A alone, too.
hth,
Heinz
Received on Fri Aug 09 2002 - 07:33:31 CEST