Skip to main content

Practical mini-book

Indexes Without Magic

How to read query plans and make the database do less work

Constantin Potapov

Senior Python Backend / R&D Engineer

For backend developers who have at least once said the dangerous phrase «we just need to add an index here». Not spells but mechanics: why one index saves your evening, another changes nothing, and a third quietly chokes writes.

PDF5 parts, 20 chaptersRussian
Download the PDF free

No email, no sign-up — just open or save it.

What's inside

Five parts — from an honest talk about what an index is for to diagnostics, anti-patterns and a final cheat sheet.

  1. Reality first

    What an index is really for, how the database finds rows, and why «just add an index» is more often self-soothing than a plan.

  2. Core constructs

    B-tree, composite indexes and column order, selectivity, covering and partial indexes, uniqueness as a business rule.

  3. Beyond B-tree

    Text, JSON and geography: GIN, trigrams, functional and spatial indexes — the index type that matches the question.

  4. Diagnostics

    How to read EXPLAIN without guessing, and a practical algorithm for designing indexes from load, not from the schema.

  5. Mistakes and a cheat sheet

    When an index becomes ballast, why the ORM doesn't repeal database physics, anti-patterns and a final cheat sheet.

In short, the whole book is about one rule:

«A good index isn't the one that exists. A good index is the one after which the database does less work — and you can prove it.»
from «Indexes Without Magic»

About the author

Constantin Potapov — Senior Python Backend / R&D Engineer. Works with Python, Django, FastAPI, PostgreSQL, MariaDB, Redis, Docker, Linux, integrations and engineering tooling.

The main professional habit is not to trust a beautiful explanation until it has passed through code, data and a reality check. A database isn't impressed by a developer's confidence and doesn't speed up from the team's good mood.

More about the author

Take the book and stop guessing from the slow query log

A short engineering book about discipline: first understand the query, then change the schema. Less magic, more observable work.

Download the PDF free

No email, no sign-up.