Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.
Guide · Web DevelopmentFree

Use The Index, Luke

A free online book that explains SQL indexing for developers, from how a B-tree is laid out to why a particular WHERE clause can or cannot use an index. It covers Oracle, MySQL, PostgreSQL, SQL Server and Db2 with product-specific notes. It is the clearest resource for turning index theory into faster queries.

Format

Guide

Topic

Web Development

Provider

Markus Winand

Time needed

Self paced

Level

Intermediate

Access

Free

What it is

Use The Index, Luke is the free web edition of Markus Winand's book SQL Performance Explained. It explains SQL indexing from the ground up for developers rather than database administrators. It starts with the anatomy of an index, the leaf nodes as a doubly linked list and the B-tree above them, and why an index lookup can still be slow. It then works through the WHERE clause (equality, primary keys, multi-column indexes, functions, ranges and LIKE), bind parameters, joins, sorting and grouping, partial results and pagination, and the effect of indexes on inserts, updates and deletes. The site presents indexing in a vendor-neutral way with notes for Db2, MySQL, Oracle, PostgreSQL and SQL Server.

Who it is for

Developers and students who know basic SQL and have learned in a database course that "indexes make queries faster", but not why a particular index helps one query and not another. It is especially useful for backend developers working with ORMs, since the site explicitly goes beyond ORM tools to the SQL they generate.

Why it is worth your time

Indexes are one of the most practical topics in database theory, and one of the most misunderstood. After the first chapters you will understand why the order of columns in a composite index matters, why wrapping a column in a function stops an index being used, and how to read an execution plan to confirm what the database is doing. That is directly useful the first time a query in your project gets slow.

Free or paid

The whole web edition is free. The same content is sold as the book SQL Performance Explained, listed on the site as from 9.95 euros (as of 2026-09) for those who want an ebook or print copy. The author also offers paid training and consulting; you do not need either.

How to use it

Read the anatomy chapter and the WHERE clause chapter first; they cover the ideas most courses skip. Then create a table with many rows in PostgreSQL or MySQL, run the example queries with and without an index, and compare their execution plans. Come back to the join, sorting and pagination chapters when your projects need them.

Common questions

Is it only for Oracle? No. It covers several databases, with product notes where behaviour differs.

Is it too advanced for a student? If you know SELECT, WHERE and JOIN, you can follow it. It assumes no knowledge of database internals.

Does it replace a database course? No. It focuses on indexing and query performance; it does not teach modelling, normalisation or transactions.

databasesqlbackend

Ready to start?

Opens on Markus Winand in a new tab.

Open resource
Link broken or out of date?

Report a problem

With "Use The Index, Luke". Only Tauseef reads this.

Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.