HackerTube.live
Books / Systems

THE READING ROOM / BOOK GUIDE

SQL Performance Explained

Markus Winand

A compact guide to why SQL queries slow down and how indexes, optimizers, and execution plans shape the answer, written for developers who already write queries and want to understand what the database does with them.

About the book

A query can return the right rows and still be slow. Markus Winand locates the reason in how the database chooses to find those rows, and builds the book around indexes and the query optimizer. The execution plan becomes the central object of study. Readers learn to read what the database reports, connect that report to the structure of the query, and adjust the query or the index accordingly.

The book is aimed at working developers rather than database administrators, and it stays close to the everyday case: an application query, a table with an index, a plan that does not use it as expected. Winand covers how indexes are stored, why column order matters, how the optimizer estimates cost, and where sorting and filtering happen. Examples carry the material, and the emphasis falls on reasoning about a specific query on a specific database.

Following the examples closely builds a working skill: forming a hypothesis about a slow query and testing it against the plan. That habit of attention is what the book sets out to teach.

How to read it

Read with a database open. The examples are most useful when run against a real schema, and checking an execution plan while reading is the point of the exercise. Pause on the index discussions and work out why a given column order helps or hurts before moving on. That reasoning transfers to unfamiliar queries better than any memorized rule.

The prose is dense and technical, and some sections assume comfort with SQL syntax and basic relational concepts. Expect to reread the optimizer material. The book is short enough to finish in a few sittings, but it works better as a reference to return to when a real query misbehaves. Keep notes on which database you are using, since behavior differs across engines.

Who it suits

Application developers who write SQL daily and have hit a query that is unexpectedly slow will get the most from this. It suits people who can already write joins and filters but cannot explain why the database chose one plan over another. Backend engineers preparing to tune a production system, and anyone who has been told to add an index without understanding the consequence, will find the reasoning useful. Readers looking for an introduction to SQL itself should look elsewhere.

Reading considerations

The book concentrates on indexing and optimizer behavior, so it is not a general treatment of database administration, concurrency, or schema design. Specific advice depends on the database engine, and behavior can differ between versions, so check recommendations against the system in use rather than applying them unchanged. Newer engine features may not appear; treat the principles as durable and the particulars as worth verifying.

Follow the HN conversation

26 different recommenders are recorded in the upstream dataset. These are AI-classified source counts, not an independent rating.

Search HN comments about this book ↗

Explore videos on the same subject ↗

Book notes prepared with DeepSeek, using catalogue records and Open Library subject information. They are reading guidance, not a personal review or a verified chapter-by-chapter account. Book details can vary by edition. HN data methodology · Book metadata and covers.