I am using SQL Server.
Is it needed to use index for any foreign key for improving speed?
Or will SQL Server do it automatically when I define foreign keys?
I am using SQL Server.
Is it needed to use index for any foreign key for improving speed?
Or will SQL Server do it automatically when I define foreign keys?
SQL Server will not automatically add an index when creating a foreign key. An index on that foreign key may help improve performance. But usually there are more columns needed from that table, so it might be a better decision to add a few more columns needed (either being part of the index or as included columns).
JOIN operations, since the FK data can be read in sorted order!