An index works like a lookup structure in a database.
Instead of scanning every row, SQL uses the index to find data quickly.
This improves query speed.
Indexes store values in sorted order.
When a query runs, SQL searches the index first.
Only matching rows are accessed.
Most databases use B-Tree structure for indexing.
This allows fast searching, insertion, and deletion.
The structure keeps data balanced.
When a query uses an indexed column, SQL avoids full table scan.
This saves time and system resources.
Indexes greatly improve read performance.
However, too many indexes can reduce write performance.
Understanding how indexes work helps optimize databases.