Query Optimization
query-optimization
Community
N+1 Queries: Detection and Prevention
What an N+1 query is, why ORMs hide them, the four ways to fix them, and the simple logging change that has caught every N+1 I have shipped since I added it.
Django ORM N+1 and prefetch_related Drill
Four questions on Django ORM patterns I keep flagging in code review: spotting N+1 in templates, choosing select_related vs prefetch_related, slicing prefetches, and avoiding the .count() trap.
MongoDB Aggregation Pipelines, by Example
Match, group, lookup, project, the four stages I use 90% of the time. Real pipelines for funnel analysis, leaderboard, and a one-stage join, with the gotchas that surprise SQL refugees.
Database Indexes Explained with Real EXPLAIN Output
What an index actually is, how the planner picks one, and the EXPLAIN output I read every day. Postgres examples, real numbers, and the three indexing mistakes I keep finding in code review.
