开发者

Best practice for indexing foreign keys on a large table

开发者 https://www.devze.com 2023-02-22 07:50 出处:网络
I have a large table (SQL Server 2008) with almost 3 million rows.It currently has a clustered index on it\'s primary key, and a non-clustered index on its foreign key.

I have a large table (SQL Server 2008) with almost 3 million rows. It currently has a clustered index on it's primary key, and a non-clustered index on its foreign key.

Almost all the queries on the table are reads based on the foreign key.

  1. Should I change the index on the table to be against the foreign key?
  2. What is the best process for doing this?

Thank开发者_运维百科s


Without knowing more about your situation, I think that changing the non-clustered index to be a non-clustered, covering index would be the best solution.

http://www.simple-talk.com/sql/learn-sql-server/using-covering-indexes-to-improve-query-performance/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号