• Xedni - Tuesday, June 27, 2017 9:21 AM

    I was discussing  include columns with a co-worker because he had put primary key columns in his list of INCLUDE columns in a non-clustered index he built. I was going to suggest he remove them (because a non-clustered index already HAS to have a reference to the primary key)

    Actually that's not technically accurate.  Non-clustered indexes will have all the key columns of the clustered index, but that does not have to be the PK.  Indeed, best overall performance often demands that it not be.  For example, you might cluster by ( datetime, location, ident ) or by ( location, datetime, ident ) but have ident alone as the PK.

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.