Re: all foreign key should have index?




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

[...]

.



Relevant Pages

  • Re: Create Table Issues
    ... unique index on BookID. ... > CONSTRAINT PubPK PRIMARY KEY ... > CONSTRAINT PubFK FOREIGN KEY REFERENCES Publisher ...
    (microsoft.public.access.gettingstarted)
  • Re: Naming conventions for special database objects
    ... If you want it to be required, why not use a DEFAULT and a NOT NULL constraint? ... identifier (VIN), and add two mutually exclusive sub-classes, Sport ... utility vehicles and sedans ... NOT NULL PRIMARY KEY, ...
    (comp.databases)
  • Re: SQL Subquery on Max(date)
    ... The overall query I'm trying to insert this select into ... LEFT OUTER JOIN ... CONSTRAINT pk_oncd_company ... PRIMARY KEY, ...
    (microsoft.public.access.formscoding)
  • Re: orace sql query
    ... "Oracle enforces all PRIMARY KEY constraints using indexes. ... believe otherwise but were that not true you could not enforce ... For example, a PRIMARY KEY constraint ... Puget Sound Oracle Users Groupwww.psoug.org ...
    (comp.databases.oracle.server)
  • Re: orace sql query
    ... "Oracle enforces all PRIMARY KEY constraints using indexes. ... believe otherwise but were that not true you could not enforce ... For example, a PRIMARY KEY constraint ...
    (comp.databases.oracle.server)