Tuesday, April 11, 2017

Quick reference for clustered index vs non clustered index



Clustered index

  • Only one clustered index in a table
  • When we create a primary key.It would default to clustered index
  • Clustered index would be sorted
  • Faster than non clustered index
  • We can have more the one column but only one clustered index

Non Clustered index

  • We can have upto 249 non clustered index
  • Data is stored in one place and the index seperately. Example if we have one million records than it would have one million rows with that column along with the row pointer
  • Order of the data stored does not have any impact on the storage in the actual table
  • Usually slower than clustered index as they have to do a lookup in the actual table
                         

No comments:

Post a Comment