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.
Paperback also available at Amazon.com.
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
Preface
Anatomy of an Index
The Leaf Nodes
The B-Tree
Slow Indexes, Part I
The Where Clause
The Equals Operator
Primary Keys
Concatenated Keys
Slow Indexes, Part II
Functions
Case-Insensitive Search
User-Defined Functions
Over-Indexing
Bind Variables
Searching for Ranges
Greater, Less and BETWEEN
Indexing LIKE Filters
Index Combine
Partial Indexes
NULL in the Oracle Database
NULL in Indexes
NOT NULL Constraints
Emulating Partial Indexes
Obfuscated Conditions
Dates
Numeric Strings
Combining Columns
Smart Logic
Math
Testing and Scalability
Data Volume
System Load
Response Time and Throughput
The Join Operation
Nested Loops
Hash Join
Sort-Merge Join
Clustering Data
Index Filter Predicates Intentionally Used
Index-Only Scan
Index-Organized Table
Sorting and Grouping
Indexed ORDER BY
ASC/DESC and NULL FIRST/LAST
Indexed GROUP BY
Partial Results
Selecting Top-N Rows
Fetching The Next Page
Window-Functions
Insert, Delete and Update
Insert
Delete
Update
Execution Plans
Database Professionals 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)
“This book is remarkably to-the-point, uses clever notation to illustrate the value distribution inside index pages, and is ripe with practical advice on index definition and usage in contemporary SQL.” (Torsten Grust, Datenbank Spektrum (2020))
Other Books referring to SQL Performance Explained
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)
More Reviews from the Web
“a great rhythm of slowly, bit by bit, building up queries and then looking at and explaining their execution plans” (Neil Sainsbury on his blog)
“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)
“Only tech book in the last few years that I read cover to cover!” (Bernd Haug on Twitter)
“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.