SQL Performance ExplainedMarkus Winand
SQL Performance Explained
by Markus Winand · first published 2011
34mentions
26recommended by
28HN commenters
2014–2025first – last mentioned
93% recommend7% neutral
Why HN recommends it
A short, readable guide to how indexes (especially B-trees) and query execution work in Oracle, SQL Server, Postgres and MySQL. Suits application developers wanting practical speedups without deep internals.
Summarised by Claude from recommending comments
Affiliate links. As an Amazon Associate I earn from qualifying purchases.






SQL Performance Explained - Markus Winand - Excellent book that gets into the internals of what developers need to know about SQL and covers each part as it relates to the 4 major SQL databases (Oracle, SQL Server, Postgres,…
on “Ask HN: What language-agnostic programming books should I read?” ↗…papers are particularly fine reading. For people who looked at this wanting to get going with using database systems (as opposed to creating them), I'd recommend: Learning SQL by Alan Beaulieu SQL Performance Explained by Markus Winand SQL Cookbook by Anthony Molinaro The three of these will take you up to a pretty useful level of SQL knowledge/understanding. The first two are fairly easy reading to boot.
on “Readings in Databases” ↗If what you are looking is a general book (not necessarily just for Postgres) I can't recommend the "Use The Index, Luke"[1] tutorial, and the accompanying book "SQL Performance Explained" by Markus Winand, enough. It doesn't go into a lot of relational theory, but it does provide a somewhat low-level description on how indices and database data are stored, and why you want to use different…
on “PostgreSQL Index Internals” ↗If you are an application programmer needing to query the database, I wholeheartedly recommend "SQL Performance Explained" by Markus Winand, or his website: https://use-the-index-luke.com/
on “Advanced SQL and database books and resources” ↗SQL Antipatterns is good as another commenter recommended. But my favourite book on the topic is Markus Winand's SQL Performance Explained. Most of it is online here: https://use-the-index-luke.com/ but I recommend buying it since it's tiny and worth its weight in gold. It's short so you actually read it and possibly reread it. It's to…
on “We saved $50k/year with a Go microservice coded in a hackathon” ↗…so far: - Pragmatic Thinking & Learning by Andy Hunt - The Design of Everyday Things by Don Norman - The Effective Engineer* by Edmond Lau - The Pragmatic Programmer by Andy Hunt and Dave Thomas - SQL Performance Explained by Markus Winand And http://teachyourselfcs.com curriculum is pretty good as well. As a side note, there's so much we can learn from game programmers and OS/database/compiler engineers.
on “Ask HN: Books you should have read when you start a career in SE / CS?” ↗I highly recommend the book "SQL Performance Explained" by Markus Winand: https://www.amazon.com/Performance-Explained-Everything-Deve...
on “How does database indexing work? (2008)” ↗[1] above is a fantastic resource. I highly recommend Markus Winand's book "SQL Performance Explained" if you're in need of better performing SQL queries. It's quite short and small, but it covers all the bases, and uses introductory language.
on “How does database indexing work? (2008)” ↗…and of course I used a throwaway address and unsubscribed immediately. It's actually probably a newsletter I wouldn't mind getting but the way it was done feels too spammy. I have Markus Winand's book SQL Performance Explained, actually paid for the download, and came away feeling cleaner. I do hear something from him through his mailing list once in a great while, and that is fine. I hope he comes out with another book someday.
on “Show HN: I wrote a free eBook about many lesser-known/secret database tricks” ↗…Application Architecture - Martin Fowler Published in 2005 I believe, but still _very_ relevant. Good concrete architecture patterns and it's cool to see these patterns before they were no-brainers. * SQL Performance Explained - Markus Winand Actually how I first convinced my company to start paying for my books (and there have been 15+ since). We had a query that was running in an absurd amount of time for our largest customer…
on “Ask HN: Best books read in 2022” ↗…being formalized - Designing Data Intensive Applications (Martin Kleppmann) - Fantastic perspective on your application's data. This is probably the most recommended book I've seen on Hacker News. - SQL Performance Explained (Markus Winand) - Just a killer, concise book to make you truly understand basic DB performance, specifically with indexes. I've met so many developers (myself included before this book) who thought any…
on “Ask HN: What's the best book you've read regarding software development?” ↗…books, which I plucked for the stuff I needed: - computer systems - bryant & o'hallaron - bpf performance tools - gregg - systems performance - gregg - every computer performance book - wescott - sql performance explained - winand - computer organization and design - hennessy, patterson - computer architecture - hennessy, patterson - algorithms - sedgewick - understanding software dynamics - sites - design of data…
on “The value of owning more books than you can read (2018)” ↗I second this. I prefer reading on pdf, so I bought the ebook[1]. The book explains indexing perfectly, and it shouldn't take you more than a day to finish. I can't recall a book having a better benefit/time ratio. I wish the author would release more books in this vein, but he hasn't. So right now I'm looking at Designing Data-Intensive Applications to learn more about different kinds of database
on “Ask HN: What is the best online resource to learn advanced SQL?” ↗If anyone is interested, Winand's book "SQL Performance Explained" [1] really goes deep into understanding and optimizing SQL queries and improving performance of SQL queries. [1] https://sql-performance-explained.com/?utm_source=winand.at&...
on “Modern SQL” ↗@MarkusWindand: Thank you for the Websites [1],[2],[3] and the book »SQL Performance Explained«[4]. [1] https://modern-sql.com/ [2] https://use-the-index-luke.com/ [3] https://db-engines.com/ [4] https://www.amazon.de/SQL-Performance-Explained-Everything-p...
on “PostgreSQL 11 Reestablishes Window Functions Leadership” ↗