Difference between Clustered index and Non clustered index
- When you create a new table there will not be any index on it. A table without any clustered index is called a Heap Table. Heap table contains data in unsorted way, that means the data rows are not stored in any particular order. The data pages are not linked in a linked list.
- Clustered Index: A clustered index is a special type of index that reorders the way records in the table are physically stored. There for table can have only one clustered index. The leaf nodes of a clustered index contain the actual data. The clustered index is implemented as a B-tree index structure that supports fast retrieval of the rows, based on their clustered index key values. The pages in each level of the index, including the data pages in the leaf level, are linked in a doubly-linked list.
- Non Clustered Index: A non-clustered index is a special type of index in which the logical order of the index doesn't match with physical order of the rows on disk. The leaf node of a clustered index does not consist of data pages. The leaf nodes contain index rows.
• In which scenarios you would use a Heap Table?
Heap table are used as staging tables, during import/export/ETL processes. Typically get truncated before the process starts. Data population happen faster, if large amount of data is there data retrieval will be very slow.
Comments
Post a Comment