Back to results for “SQL Queries”
SQL Server › Indexes

What is an index in SQL Server, and how does it help speed up queries?

Beginner

Answer

An index creates a separate, organized structure that lets SQL Server quickly locate specific rows in a table without scanning every single row, similar to how the index at the back of a book lets you jump directly to a topic instead of reading every page to find it.
CREATE INDEX IX_Customers_LastName
ON Customers(LastName);
Real-world example An online store creates an index on the customer's last name column, dramatically speeding up a customer service search feature that frequently looks up customers by their last name.

Common follow-ups: Does adding more indexes always improve query performance?;What is the tradeoff of having too many indexes on a table?