Foreign Key Indexes and Binding

  • Great article, thank you.

  • I'm glad you enjoyed it.


    Steve Hood

    Blog: Simple SQL Server
    Twitter: @SteveHoodSQL


  • With regard to foreign key index binding, Dan Guzman blogged in depth about this :

    "SQL Server chooses the index binding based on rules that vary by version so you will get different binding depending on your version of SQLServer. SQL Server 2005 chooses the clustered index when possible and, if no suitable clustered index exists, the first (lowest index_id) unique non-clustered index on the referenced column(s) is used.

    In later versions (SQL 2008, SQL 2008R2 and SQL 2012), the foreign key is bound to the unique non-clustered index on the referenced column(s) with the lowest index_id when possible. Only when no suitable unique non-clustered index exists is the unique clustered index chosen."

    Hope this contributes to the discussion.

  • xoraclez (3/28/2016)


    With regard to foreign key index binding, Dan Guzman blogged in depth about this :

    "SQL Server chooses the index binding based on rules that vary by version so you will get different binding depending on your version of SQLServer. SQL Server 2005 chooses the clustered index when possible and, if no suitable clustered index exists, the first (lowest index_id) unique non-clustered index on the referenced column(s) is used.

    In later versions (SQL 2008, SQL 2008R2 and SQL 2012), the foreign key is bound to the unique non-clustered index on the referenced column(s) with the lowest index_id when possible. Only when no suitable unique non-clustered index exists is the unique clustered index chosen."

    Hope this contributes to the discussion.

    Did Microsoft ever say why they switched to preferring non-clustered indexes for this binding? What performance implications does it have, if any?

    Tom

  • This was removed by the editor as SPAM

Viewing 5 posts - 16 through 19 (of 19 total)

You must be logged in to reply to this topic. Login to reply