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.
Author |
Topic |
indersshekhawat
Starting Member
26 Posts |
Posted - 2008-03-29 : 03:39:25
|
sir, i have two option 1. my primary table and second table are join in a query. but i not set primary key and forign key realtion ship 2. i set the realtion ship and then do the querywhich option is fast for searching data |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-03-29 : 11:23:14
|
Adding foreign keys does not help with performance, but adding an index on those same columns does.When you add a primary key to a table, you automatically get an index with it. But SQL Server does not automatically add indexes to foreign keys, so we must add those manually. All foreign keys should have a respective index created.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2008-03-29 : 14:36:46
|
An index on the referenced column(s) in the secondary table will probably help. Make it a unique index if it is unique.Whether this should be clustered or not or include other columns depends on your system.An index on the primary table column(s) may help but again depends on your system.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|