The reason for indexing a foreign key column is the same as the reason for indexing any other column: create an index if you are going to filter rows by column.
For example, if you have a table [User] (ID int, Name varchar (50)) and a table [UserAction] (UserID int, Action varchar (50)), you most likely want to know what actions a specific user is. For example, you will run the following query:
select ActionName from [UserAction] where UserID = @UserID
If you are not going to filter rows by column, then there is no need to put an index on it. And even if you are worth it, only if you have more than 20-30 rows.
ItsMe Nov 06 '12 at 3:01 2012-11-06 03:01
source share