SQL Performance Explained helps developers to improve database performance. The focus is on SQL-it covers all major SQL databases without getting lost in the details of any one specific product. Starting with the basics of indexing and the WHERE clause, SQL Performance Explained guides developers through all parts of an SQL statement and explains the pitfalls of object-relational mapping (ORM) tools like Hibernate. Topics covered include: Using multi-column indexes; Correctly applying SQL functions; Efficient use of LIKE queries; Optimizing join operations; Clustering data to improve performance; Pipelined execution of ORDER BY and GROUP BY; Getting the best performance for pagination queries; Understanding the scalability of databases. Its systematic structure makes SQL Performance Explained both a textbook and a reference manual that should be on every developer's bookshelf.
Good introduction into how databases uses indices to make effective and efficient queries. Relatively small chapters that focus on one topic at a time and use examples and visualization a to explain the topics discussed. I had never read anything about SQL performance before and this served as a very good introduction. I imagine this being a good reference to come back to when tackling performance problems.
Very condensed guide to everything related to indexes in relational databases. It's just 200 pages long, so you can read this in 3 days, and you can't get more information in such a short timespan from anywhere else. It's also very practical, so you'll rarely see mentions of deep under-the-hood stuff or how specifically it works - more about "how you can benefit from it working that way". The only con is it can be somewhat dated by now, though I suppose at least 80% are still widely applicable.
This little book contains so many useful nuggets of information. It focuses largely on indexes, but also touches on things like query parameters and their gotchas. With each major feature Winand includes a table listing usage details specific to each SQL implementation. Definitely worth a read.
It's really strange that there are so few SQL and relational data management books written for a general developer audience. RDBMS systems are integrated in all kinds of applications that deal with user data, and a big majority of web aplications interface to them. The job of creating, running and optimizing SQL, however, has been delegated to specialized subsystems such ORM's, and DB administrators. The results are the various horrendously performing web applications that I have had the pleasure to work with, and the weird ORM generated schemas that worked perfectly well in local development or testing, but turned out to be ticking timebombs on production systems.
This book fits perfectly in this space of SQL books for all developers. Its aim is to concisely explain principles of database performance and optimization, focusing on the most important tools that all databases provide, especially the B-tree index. Winand starts with a description of how databases organize data, and how B-tree indexes are used to find the relevant data. The discussion of indexes is coupled with many concrete examples and tips on finding out how a database is processing a query. The examples are for Oracle databases,and in some places, there are lengthy discussions of Oracle-specific topics (such as non-standard handling of NULL values), but they are mostly applicable to other databases, especially PostgreSQL. There is also an appendix on using the query explainers of various RDBMS systems. Winand goes into detail on various ways of creating indexes (e.g. covering and partial indexes), and for which scenarios these different methods are suitable, without getting lost in text. The discussion of index-related topics takes approximately half of the book. The rest is dedicated to other RDBMS functionalities such as joins, insert and update statements, but always with a focus on how the index can be used to make these processes faster and more efficient, and how various indexes themselves are affected.
The most obvious shortcoming of SQL Performance Explained is that there is no sample data set for experimenting. I had the chance of appying many techniques described here to our production database, but directly experimenting with a sample database with various complexities would lead to a better learning experience in general. Clarity also sometimes suffers from the conciseness. For example, some terms are not defined, such as access rate on p. 86 or what to materialize means, on p. 140. Generally useful would have been a glossary that defines the most important terms. That said, if such minor ommissions that can be completed by a quick web search are the price of the conciseness of this book, this is a price I'm happy to pay.
If you are going to read only one book about database performance,there are much worse choices than SQL Performance Explained. But do read more books about databases in general, so that I don't have to take over another agonizingly slow legacy system.
This is the printed version of "Use the index, Luke." It avoids the Jedi goofiness—and the author's unsettling gaze. It's pretty good, especially for a self-published book, and it delivers on the promise of explaining, very accessibly, how SQL engines run.
The mental model offered goes beyond just "index means O(log(n))," though there are the obligatory graphs showing linear vs. log growth. Winand describes tree traversal of indexes, but then also (depending on data and query) linked-list traversal, and how this relates to accessing data that isn't in the index, and connected trade-offs.
The material starts rudimentary, but reaches details such as this, on page 140:
"The Oracle database cannot read an index backwards in order to execute a pipelined group by that is followed by an order by."
One of the most interesting things for me turned out to be the frequent comparisons and notes specific to SQL implementations. Very often the notes were explaining that MySQL didn't offer a particular feature, or that a feature was only available in Postgres. MS SQL Server and Oracle seem to be somewhere in the middle.
The level of detail was also sufficient to make clear that declarative languages like SQL are not the panacea that they are sometimes made out to be. I hadn't realized, for example, that SQL engines make execution choices based on statistics they keep about the data they store, and that those statistics can be incorrect, leading to bad choices.
Winand is also critical of ORMs that can lead to bad SQL. Though I didn't find these examples particularly compelling, I do think it's a related case of trading control for convenience.
Also, the book comes with a bookmark, which is a laminated miniature of the cover.
It's short and very well-written. It's the most valuable read on SQL I've ever seen. Usually I avoid reading books online because it's distracting but I couldn't switch to anything else until I finished it.
It's here
Hard to say what was the most useful in this book. It's dense with advice. Maybe the most important thing for backend developers is .
I wish there was a book about other index types (this one explains B-tree indexes in detail).
This is just brilliant. I had the pleasure and joy working with Markus on a small task where I could see and experience his profound knowledge on SQL performance. This made me buy this book. Reading this book now got me back to that time and as I already saw that the knowledge and efficiency taught in this book is really paying off, it was an even greater joy reading more about the underlying magic behind this performance improvements.
It takes real skill to explain relatively complex things so simply. I was also impress by Winand's ability to split the content into bite-sized chapters which makes reading effortless as opposed to some work you have to do (even if you do it for work)
The best book related to the SQL Performance I’ve ever read. It’s totally must-read position for every backend developer in my opinion. Highly recommended, short and concrete - awesome!