Book: Database Playbook
Also by me: Thinking in Go (2-book series) — Complete Guide to Go Programming + Hexagonal Architecture in Go
My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools
Me: xgabriel.com | GitHub
A page of 100 orders, 101 round trips to Postgres , and every test on the agent's branch is green.
The agent's GET /orders handler returns each order with its customer's name. It fetches the orders, then loops over them and fetches each customer with its own query: one for the list, one per row. The diff is short and readable, and the test data has two rows.
That is the N+1 query problem. The Laravel docs put numbers on it: 25 books and their authors, loaded in a loop, "would run 26 queries". Your functional tests don't catch it. They check the JSON, and the JSON is correct. None of them counts the queries behind it.
So you add a test that does.…