Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Does a foreign key automatically get an index?

Author  Topic 

X-Factor
Constraint Violating Yak Guru

392 Posts

Posted - 2007-05-23 : 06:00:23
...or should I add one manually?

mwjdavidson
Aged Yak Warrior

735 Posts

Posted - 2007-05-23 : 06:15:30
No, and probably yes.

Mark
Go to Top of Page

X-Factor
Constraint Violating Yak Guru

392 Posts

Posted - 2007-05-25 : 18:53:54
ok, thanks.

Also, do indexes help order by clauses?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-05-25 : 18:57:00
You definitely should add indexes to FKs. And yes indexes help order by clauses. If you find yourself ordering by the same columns or columns in most queries, then you might consider making that the clustered index.

Tara Kizer
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -