If two tables have foreign keys to the same primary key of another table, does that mean that two indexes are created for those foreign keys or do they use the same index (the primary key index?)
+3
A:
Two indexes will be created; one for each foreign key (making for a total of three including the index on the primary key column). It should be noted that this is not true of other database systems which require you to explicitly add an index on a foreign key. MySQL's innodb requires that an index be created when creating a foreign key relation.
See Foreign Keys for more.
Thomas
2010-08-24 00:22:51