You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Indexes are the single most important factor in SQL Server query performance. This lesson covers clustered and nonclustered indexes, execution plans, statistics, and common performance patterns.
An index is a data structure (typically a B-tree) that allows SQL Server to find rows quickly without scanning every page in the table.
Think of it like the index in the back of a textbook — instead of reading every page, you look up the term in the index and jump directly to the right page.
A clustered index determines the physical order of data in the table:
-- Clustered index is created automatically with PRIMARY KEY
CREATE TABLE Customers (
CustomerId INT PRIMARY KEY, -- clustered index
Name NVARCHAR(100),
Email NVARCHAR(200)
);
-- Or create explicitly
CREATE CLUSTERED INDEX IX_Customers_CustomerId ON Customers(CustomerId);
The clustered index key should be:
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.