Re: all foreign key should have index?
From: Tony Rogerson <tonyrogerson_at_sqlserverfaq.com>
Date: Tue, 31 Jan 2006 20:28:43 -0000
Message-ID: <droh92$p8u$1$8302bc10_at_news.demon.co.uk>
Date: Tue, 31 Jan 2006 20:28:43 -0000
Message-ID: <droh92$p8u$1$8302bc10_at_news.demon.co.uk>
Good point, but I'd rather have the control, consider a trading table that you don't delete from as one example, there are dozens of others.
-- Tony Rogerson SQL Server MVP http://sqlserverfaq.com - free video tutorials <lennart_at_kommunicera.umea.se> wrote in message news:1138736733.065152.321970_at_z14g2000cwz.googlegroups.com...Received on Tue Jan 31 2006 - 21:28:43 CET
>
> Tony Rogerson wrote:
>> That would be a look up on the primary key though, rather, the key you've
>> reference on the foreign key clause....
>>
>> So in this example...
>>
>> create table test2 (
>> mycol_id int not null constraint pk_test2 primary key clustered
>> )
>>
>> create table myothertable (
>> blah int not null constraint pk_myothertable primary key clustered,
>> mycol_id int not null references test2 ( mycol_id )
>> )
>>
>> What is the point of indexing mycol_id?
>>
>
> delete from test2 where ...
>
> /Lennart
>
> [...]
>