Home > Archive > microsoft.public.sqlserver.server > December 2002 > Foreign Key indexes





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Foreign Key indexes
Jake Dutra

2002-12-06, 10:23 am

Simple question: Does SQL Server use the foreign key
constraint like an index? Or do I need to create a
separate index for it to be used in SELECT statements.
In other words, SELECT * FROM TABLEX WHERE COL1=2 ---if
COL1 has a foreign key constraint, do I still need to add
an index if I want an index used in the select statment?
Thanks
Kalen Delaney

2002-12-06, 10:23 am

An index is a separate physical structure, and defining a foreign key does
not create this structure. Only Primary Key and unique constraints will
build indexes. If you want an index on a column defined as a FK, you must
create one.

HTH
--
Kalen Delaney
SQL Server MVP


"Jake Dutra" <webster0001@hotmail.com> wrote in message
news:0b1f01c29d3b$abc23ce0$d5f
82ecf@TK2MSFTNGXA12...
> Simple question: Does SQL Server use the foreign key
> constraint like an index? Or do I need to create a
> separate index for it to be used in SELECT statements.
> In other words, SELECT * FROM TABLEX WHERE COL1=2 ---if
> COL1 has a foreign key constraint, do I still need to add
> an index if I want an index used in the select statment?
> Thanks



Sponsored Links





Free Braindumps | MCSE braindumps software forum

Copyright 2003 - 2008 examnotes.net