More SQL Antipatterns

Avoid Common but Deadly Mistakes of Database Optimization

by: Bill Karwin

Published 2026-03-10
Internal code bksap2
Print status In Print
Pages 220
User level
Keywords
Related titles
ISBN 9798888652060
Other ISBN Channel epub: 9798888652077
Channel PDF: 9798888652077
Kindle: 9798888652077
Safari: 9798888652077
Kindle: 9798888652077
BISACs

Highlight

Most of us taught ourselves SQL; we learn what works on the job. This book (and its companion) contain years of accumulated experience of what works and, more importantly, what doesn’t. This volume focusses on scaling and performance. See why the solutions you find online are often unhelpful (or just plain wrong). Learn how the database handles complex queries so you can better predict what works and what doesn’t. See when to denormalize for performance, and how to do it right. Learn when to use JSON columns. Along the way, discover a bunch of SQL tricks you never knew existed.

Description

It’s easy to get something working with SQL but getting it working well requires skill and experience. Rather than learning by trial and error, let renowned database expert Bill Karwin give you the benefit of his years of experience as he shows you the mistakes people make and how to fix them.

Dig into SQL language issues rarely covered in other books. Learn advanced queries such as relational division, efficient pagination, and pivoting. Explore tradeoffs in optimization, including denormalization, JSON, and choosing SQL versus NoSQL. Turn mistakes into successes by employing SQL in application design: transactions, polling, and object-relational mapping. Finally, take a deep dive into scaling out with sharded databases.

This book contains fourteen all-new topics, making it a valuable complement to SQL Antipatterns Volume 1. In each chapter, you’ll learn how to recognize one type of common pitfall, and how to solve it. Examples use the current popular combination of PostgreSQL and Python, but the principles apply to any modern database and language. Like the first volume, this book also includes a selection of mini-antipatterns, or brief tips you can use for quick wins.

Optimize SQL the right way and graduate from journeyman to senior database developer.

Contents and Extracts

Table of Contents