Hi, I gave a mildly popular talk about database indexing in 2018. If you haven’t already, please check it out below. It’s ok, I’ll wait.

If you are one of the people who enjoyed this talk and learned something from it, you’re going to love what I’m working on next.

Because you see, to get this talk to fit into—even a quite generous—45‑minute conference slot, I had to cut out a lot of stuff. Interesting stuff, useful stuff! Stuff that people should know!

“This won’t do”, I thought.

This won’t do.

— Me, anno 2021

Which is why I am writing a book on database indexing specifically targeted at developers. That’s right, dear reader, I’m talking about you.

Developer’s Guide to Database Indexing

“An index makes queries faster” is about the most basic description of a database index. It’s also about as well as I understood indexing for a long time. Judging from the reception of my talk, I’m not alone in that.

In this book I want to teach you everything I know about database indexing. Here’s an incomplete list of things this book will cover:

  • B-Trees. The data structure behind it all
  • Indexing simple queries to improve read performance
  • Compound (multi-column) indices and common pitfalls when using them
  • Developing intuition about indices
  • Debugging slow queries by analyzing the execution plan
  • Different ways the database uses (or doesn’t use) an index, like full table scans and range scans
  • What data actually gets stored on an index and why you should care about this
  • What are the trade-offs when using indices? You may have heard that they make writing slower. But why?
  • Why LIKE %search-term% is probably a bad idea
  • Why not using an index can be the more performant option in certain cases
  • ...and a bunch of other stuff I probably forgot

Interested?

Share your email with me and you’ll be the first to know when the first chapters get published.

No spamming you. Pinky promise.

Goals of this book

I have three major goals in writing this book. The whole reason I have decided to write Yet Another Book is because I have yet to find a book on this topic that ticks all three boxes for me.

Focus on developing intuition. I’m a strong believer in developing intuition over memorizing facts. The great thing about indexing is that it can be demonstrated beautifully with only a few tables that are sorted in different ways. There will be Try it yourself sections throughout the book that let you take a turn at being the database. This way, you can get a feeling for why an index works or doesn’t work in certain situations.

Aggressively practical. No theory for theory’s sake! We always start out with a real problem we want to solve. Then we learn what we need to learn in order to accomplish this. That doesn’t mean that we will dumb things down or shy away from the details, however. We will go as deep as necessary to really understand the problem. But at no point will you go “wait, how does this help me again?”.

Fun to read. I get it, no one sets out with the goal of writing a boring book (although that could be a cool novelty book). But at least for me personally, a lot of them still miss the mark. I’m not trying to write a reference manual. I want to write something you can read cover to cover and actually enjoy. If you like the style of writing on this page, you’ll probably enjoy the book. If not, well, I guess it’s an acquired taste.

Frequently Asked Questions

Look, we both know that no one has asked these questions, much less frequently. This site has only just gone up. But here we go anyways.

Cut the crap. How much will it cost?
Nothing.
Seriously?
Yup. The entire book will available online for free. Once I’m done writing all the chapters, I will work on a paid PDF version. But the web version will be Free Forever.
You might be the worst businessman ever.
Quite possibly.
What is the release date?
Hah, funny! It’s way to early for me to give any sort of reasonable estimate. I’m a developer, after all.
That’s very unhelpful.
Ok, how about this. The book will be released one chapter at a time. But I’m not going to publish it until I have finished the first two chapters. At my current rate, my best guess is in another month or two. Which reminds me...

Get notified

Great segue, eh? Sign up for the mailing list and get notified as soon as I get my shit together publish the first chapters.

No spamming you. Pinky promise.
The ugly mug of the author

About the author

I’m Kai Sassnowski. You can find me on Twitter at @warsh33p, on GitHub, or on my blog.

I have created several open source packages as well as spoken at multiple conferences.