Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2004
    Location
    UK
    Posts
    40

    Unanswered: Foreign Keys - Indexed by default?

    Title says it all really?
    Are foreign keys indexed by default or do I have to add an index to those fields where I deem appropriate?
    If it makes any difference i've posted in this board because i'm using SQL Server 2000, I don't know if it is different for each platform.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    definitely you need to declare the indexes if you want them
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Apr 2004
    Location
    UK
    Posts
    40
    Thanks r937, as usual your help is always appreciated.

  4. #4
    Join Date
    Apr 2004
    Location
    UK
    Posts
    40
    Hi,

    Me again - I just realised that I've presumed that Primary Keys are automatically indexed.... is this true?

    Call me crazy but that just makes sense to me

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    primary keys automatically have an index, foreign keys don't
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •