Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
328 views
in Technique[技术] by (71.8m points)

indexing - SQL Server unique vs not unique index INSERT performance

I would like to create a covering index to improve query performance. I do know that this one more index will impact INSERT performance.

The table has only INSERT operations no UPDATE or DELETE. The data in covering index will unique because the index keys contain the table's PK, so I need no further constraining uniqueness, my only goal to improve query performance.

Question

Which type of index will the optimal (means degrade less) the INSERT performance, unique or not unique?

question from:https://stackoverflow.com/questions/65871602/sql-server-unique-vs-not-unique-index-insert-performance

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Which type of index will the optimal (means degrade less) the INSERT performance, unique or not unique?

The difference if any is negligible.

On the other hand, what could have some impact is the index key length. Smaller is better. You could remove the primary key from the index key and make the index non unique. It will remain being a covering index because all non clustered indexes have the clustered index key on leaf page nodes, assuming your primary key is clustered.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...