SQL Performance Explained

A Book For Developers

SQL performance books are tomes.

Hundreds of pages filled with knowledge…
…not relevant to developers.

SQL Performance Explained focuses on what developers need to know.

Just 200 pages…
…yet covering all major databases.

(PayPal, global free shipping)


Paperback also available at Amazon.

(paperback only, paid link)

Amazon Reviews ★★★★★

SQL Performance Explained enjoys a five star rating at Amazon.com and Amazon.co.uk.

“This is the best book on indexes that currently exists in the market” (Paul Barrett at Amazon.com)

“Beginners will find it an easy read but even our most senior developer learned from it” (Amazon Customer at Amazon.com)

“This book covers SQL in general but, importantly, makes it concrete by providing examples in *multiple* popular databases” (Sorpigal at Amazon.com)

“The book isn’t even 200 pages long. […] A worse author would’ve made this book 1000 pages long.” (rewazi at Amazon.com)

“An eye-opener on SQL performance” (Daniel Woods at Amazon.co.uk)

“A must have for all developers who deal with SQL!” (Henry Biney at Amazon.co.uk)

“Most useful book I’ve read, taking into account its size” (Sergey Gulik at Amazon.co.uk)

“I was struggling with a query that was taking about 1 minute, 30 seconds to execute. 43 pages in and it is now executing in 3 seconds” (Mr. B at Amazon.co.uk)

Table of Contents

  1. Preface

  2. Anatomy of an Index

    1. The Leaf Nodes

    2. The B-Tree

    3. Slow Indexes, Part I

  3. The Where Clause

    1. The Equals Operator

      1. Primary Keys

      2. Concatenated Keys

      3. Slow Indexes, Part II

    2. Functions

      1. Case-Insensitive Search

      2. User-Defined Functions

      3. Over-Indexing

    3. Bind Variables

    4. Searching for Ranges

      1. Greater, Less and BETWEEN

      2. Indexing LIKE Filters

      3. Index Combine

    5. Partial Indexes

    6. NULL in the Oracle Database

      1. NULL in Indexes

      2. NOT NULL Constraints

      3. Emulating Partial Indexes

    7. Obfuscated Conditions

      1. Dates

      2. Numeric Strings

      3. Combining Columns

      4. Smart Logic

      5. Math

  1. Testing and Scalability

    1. Data Volume

    2. System Load

    3. Response Time and Throughput

  2. The Join Operation

    1. Nested Loops

    2. Hash Join

    3. Sort-Merge Join

  3. Clustering Data

    1. Index Filter Predicates Intentionally Used

    2. Index-Only Scan

    3. Index-Organized Table

  4. Sorting and Grouping

    1. Indexed ORDER BY


    3. Indexed GROUP BY

  5. Partial Results

    1. Selecting Top-N Rows

    2. Fetching The Next Page

    3. Window-Functions

  6. Insert, Delete and Update

    1. Insert

    2. Delete

    3. Update

  7. Execution Plans

Other Authors about SQL Performance Explained

“This book is definitively worth having in the company library” (Joe Celko on i-programmer.info)(Joe Celko helped write the SQL standard)

Troubleshooting Oracle Performance (2nd ed)(Christian Antognini)

Accelerating MATLAB Performance: 1001 tips to speed up MATLAB programs (Yair M. Altman)

Relational Database Design and Implementation(Jan L. Harrington)

High-Performance Java Persistence(Vlad Mihalcea)

Google Scholar search reveals that there are some academic papers referencing to SQL Performance Explained (Google Scholar search)

More Reviews from the Web

“This book has easily been one of the most influential on my career.” (mhotchen on Hacker News)

“A Rosetta stone for SQL query tuning.” (Sean Hull on his blog)

“SQL part of your work? Read SQL Performance Explained” (Honza Horak on his blog)

“The number of new questions you post to stackoverflow.com may drop significantly.” (Michał Kołodziejski on the Vertabelo blog)

“…a ton of useful information for developers…” (Denis Gobo on his blog)

“It was a pleasure for me to read SQL Performance Explained” (Dani Schnider on his blog)

“…best SQL related book I’ve read so far…” (Philip Riecks on his blog)

“I wish I had read this book a long time ago” (Andrew Cooke on his blog)

“Oh I really love it and I learned so many things in one week!” (Andrew Marcinkevičius on his blog)

“A wonderful book…I highly recommend it.” (Anders Janmyr on his blog)

“It is a short book … I personally love this - because the author has focused on what is important…” (Morgan Tocker on his blog)

“If you haven’t read it yet, order it right now! You won’t be disappointed” (Petri Kainulainen on his blog)

“Markus’s book helped me understand so so much about the Postgres database and what I was doing wrong.” (Louise Grandjonc in an interview by citusdata)

Bought the PDF Before?

If you have bought the PDF edition of SQL Performance Explained before, you can download it again. You’ll get an e-mail with a link to the latest and greatest version.

About The Author

Markus Winand is an independent author, trainer and consultant on all things SQL. His book “SQL Performance Explained” has just been translated into a fifth language. It can be purchased as a print edition, and it’s also available to read for free on his use-the-index-luke.com website. Markus is currently working on his second book centered on the idea that things have changed a lot since SQL-92. It is likewise available free of charge online (modern-sql.com). Find his offerings for companies and developers at winand.at.

Connect with Markus Winand

Markus Winand on LinkedInMarkus Winand on XINGMarkus Winand on Twitter