Database
database
System Design
SQL vs NoSQL - Choosing the Right Database
SQL vs NoSQL is the most common storage decision in system design interviews. SQL databases give you ACID guarantees, joins, and a fixed relational schema; NoSQL databases give you flexible schemas, horizontal scaling, and specialized data models. This lesson teaches you the four NoSQL families, the real engineering trade-offs, and a clear decision framework so you can defend your database choice in any interview.
Database Indexing & Query Optimization
Indexes turn O(N) full-table scans into O(log N) lookups, but every index costs storage and slows writes. This lesson teaches how B-tree and hash indexes work, when to use composite or covering indexes, how to read an EXPLAIN plan, and the common indexing mistakes that cause production outages. By the end you can defend any indexing decision in an interview and diagnose a slow query in production.
Database Sharding & Partitioning Strategies
Sharding splits a database into many smaller pieces (shards) so writes and storage can scale across servers. The hard part is not the splitting; it is choosing a shard key that avoids hot shards, supporting cross-shard queries, and rebalancing as the data grows. This lesson covers the four sharding strategies, how to pick a shard key, the operational realities of resharding, and when sharding is the wrong answer.
Community
Transaction Isolation Levels with Failing Examples
Read uncommitted, read committed, repeatable read, serializable. Each level explained with a runnable two-session SQL example showing exactly which anomaly it allows or prevents.
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.
PostgreSQL MVCC and Isolation Level Deep Dive
A 5-question reference set on PostgreSQL's MVCC implementation: tuple versioning, READ COMMITTED vs REPEATABLE READ vs SERIALIZABLE, row-level locks, and the autovacuum machinery that keeps txid wraparound at bay.
SQL vs NoSQL: Stop Asking the Wrong Question
The choice that matters is not the data model. It is which guarantees you need on read and write. A decision table and the JSONB middle ground that retired half my Mongo use cases.
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.
B-Trees and Why Databases Love Them
High fanout, leaf chaining, and the asymmetric access cost that has kept the B+ tree at the heart of PostgreSQL, MySQL InnoDB, MongoDB WiredTiger, and SQLite for fifty years.
Database Migrations: A Zero-Downtime Playbook
Adding a column, renaming a column, dropping a column, splitting a table. The expand-contract pattern, the four-step rename, and the migration phases that have kept me from taking the site down.
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.
Connection Pooling, PgBouncer, and the Prisma Trap
What a connection pool actually does, why your Postgres falls over at 200 connections, where PgBouncer sits, and the prepared-statement bug that bites every Prisma team that adds it the wrong way.
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.
