Tuesday, December 21, 2021

Clustered and Non-clustered Index

MICROSOFT SQL SERVER 




Hello Readers, 


                Clustered Index 


A clustered Index determines the order in which data is stored in table, therefore a table can have only 1 Clustered index. primary key constarint create clustered index.

 Eg:- when you insert data into table with randow id's 3 1 4 5 and you do
 select * from table_name ; 
you will see all the rows are arranged in ascending order of Id's 1 2 3 4 5 
irrespective at what time or sequence they were inserted 
the rows will arrange themselves in order with id.

 it is similar to Telephone Directory (data is arranged in order and NO SEPERATE INDEX PAGE ). 


                  Non Clustered Index


It is similar to INDEX PAGE in any Book . Index is stored differently and data is stored differently. 
It will not affect the way in which data is stored in table. there can be more than 1 Non Clustered Index . 

They Require Additional Disk Space ( because Another Duplicate copy of All records is created for 1 Non Clustered Index) 

  Thanks for visiting my Blog.

Clustered and Non-clustered Index

MICROSOFT SQL SERVER  Hello Readers,                      Clustered Index  A clustered Index determines the order in which data is stored i...