Skip to main content

Performance for SQLs

SQL performance is about making queries return quickly as data grows. Indexes, most often B-tree, let the engine find rows without scanning the whole table, and the query plan from EXPLAIN shows how it will execute. Reading plans reveals missing indexes, poor join orders and costly sorts, so tuning is based on evidence.

Stage: Performance and Practice · Part of the SQL roadmap · Last reviewed 19 November 2026

What to learn in Performance

Performance interview questions

Why might a query not use an existing index?

Common reasons are applying a function to the indexed column, a leading wildcard in LIKE, a type mismatch, low selectivity where scanning is cheaper, or stale statistics. The planner chooses the cheapest plan it estimates, so check EXPLAIN rather than assuming.

How does column order in a composite index matter?

An index on (a, b) is sorted by a then b, so it serves filters on a, or on a and b, but not b alone. Put equality-filtered and more selective columns first, and align trailing columns with sorting needs.

Where Performance fits in the SQL roadmap

Performance belongs to the Performance and Practice stage (intermediate level), which takes about 18 hours. Make it fast and correct.

Back to the full SQL roadmap