Reputation: 73
For performance on SQL Server, does it matter if a single column primary key is located at the beginning of the table versus further down in the list (fourth or fifth column)?
Upvotes: 0
Views: 1090
Reputation: 28900
In a page ,SQL Server will re-arrange your columns to store all of the fixed width columns first and the variable columns last. In both the fixed-width portion of the row as well as the variable-width portion of the row, the columns are defined in the order in which they are declared.
When you create a Table with Primary Key/create an Index ,SQLServer arranges its rows(columns will be defined in above said order) internally based on Primary key sort order..
Any Incoming rows will be added based on that order..not based on column position..
So it doesn't matter what is the ordinal position of the primary key..
Upvotes: 3