views:

61

answers:

2

Is it a good practice to create an index to every foreing key in my database?

+4  A: 

Yes it's a good practice, see here: When did SQL Server stop putting indexes on Foreign Key columns? scroll down to the Are there any benefits to indexing foreign key columns? section

SQLMenace
+2  A: 

Every foreign key? No. Where the selectivity is low (i.e. many values are duplicated), an index may be more costly than a table scan. Also, in a high activity environment (much more insert/update/delete activity than querying) the cost of maintaining the indexes may affect the overall performance of the system.

onedaywhen
OK. So is there some numeric limit or threshold that may trigger the creation of an index?
GRGodoi