From the course: Developing Microsoft SQL Server 2016 Databases
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Clustered indexes - SQL Server Tutorial
From the course: Developing Microsoft SQL Server 2016 Databases
Clustered indexes
- [Instructor] The primary index for a table is called the clustered index. When a clustered index is applied to a data table the rows in the table get sorted and stored based off of the clustered indexes key value. A clustered index is what converts a heap into an orderly arrangement that allows record seeking rather than just full table scans. In essence, clustered indexes not only define the sorting order for a table, they are the table. This is why there can only be a single clustered index per table, as there's only one way that the table will naturally be stored on disk. When a clustered index is applied to a heap, the records are sorted according to their indexing column or columns, and records are divided up into pages on disk. This makes getting to a specific record easy when searching by the key value, in this case an incrementing identity integer. Once SQL Server arrives at the appropriate leaf, all of the other columns of information are stored there as well, and the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.