SQL databases use indexes to accelerate query performance. A B-tree index organizes rows in sorted order so range queries and equality lookups execute faster. Composite indexes cover multiple columns and can satisfy queries that filter on all indexed columns. The query planner chooses whether to use an index based on cardinality and selectivity estimates. EXPLAIN ANALYZE reveals the actual execution plan and identifies table scans that should be replaced with index scans. Covering indexes eliminate heap fetches by storing all required columns in the index leaf pages.
