I have a table called Transactions with the following schema:
ColumnName DataType Constraints ---------- ---------- ----------- id int PK (Cluster-Index) details varchar(50)
Later on, I add the following two columns to this table:
ColumnName DataType Constraints ---------- ---------- ----------- id int PK (Cluster-Index) details varchar(50) date datetime comment varchar(255)
What will be the index performance on that table with the following query?
select * from transactions where id=somenumber
Will the performance change because I added the two columns? Will there be an effect on the clustered index?
Your performance will roughly be the same. Your clustered index defines the physical ordering of the rows. When you do a query on a clustered primary key, the database essentially does a binary search for your data. The result of adding columns means that not as many rows fit on the same data page. This means the database may have to do a bit more IO to get the same data.