Databases
Choosing a database, designing tables, migrations, indexes, connection pooling, and backups you have actually restored.
36 posts · page 2 of 2
Docker Volumes vs Bind Mounts: Where Your Data Actually Lives
Containers are meant to be thrown away. Your database, uploads, and certificates are not. The three ways Docker stores data — the container layer, named volumes, and bind mounts — what survives what, the command that silently deletes your database, and how to back a volume up.
How to Design Your First Database (Without a Computer Science Degree)
Before you ask an AI tool to 'build the database', spend fifteen minutes on paper. How to find your tables, choose columns and types, connect tables with foreign keys, handle one-to-many and many-to-many relationships, and avoid the mistakes that are painful to fix later.
Dates and Time Zones in Apps: How Not to Get Them Wrong
Reminders sent an hour late, bookings on the wrong day, 'yesterday' that's actually today. Why dates are hard, the golden rule (store UTC, display local), ISO 8601, time zones vs offsets, daylight saving traps, and how to check your AI-built app handles them.
Database Transactions Explained: ACID, Isolation Levels, and Race Conditions
Transactions make several changes succeed or fail together — but they don't automatically prevent race conditions. ACID in practice, PostgreSQL's isolation levels, lost updates and write skew, SELECT FOR UPDATE, serializable retries, and the transaction mistakes that cause outages.
What Are Database Migrations? A Plain-English Guide
Migrations are how an app's database changes shape over time without losing data. What they are, why AI-built apps get them wrong, how to make a risky change safely, and the rules that stop a schema change from becoming a data-loss incident.
Database Indexes: Why Your App Got Slow and How to Fix It
The app was fast with 100 rows and crawls with 100,000. The fix is usually an index. How indexes work, how to find the slow queries, how to read EXPLAIN ANALYZE, which columns to index (including the foreign keys ORMs forget), and what indexes cost.
Claude Code Checkpoints: How /rewind Works and What It Can't Undo
Press Esc twice and Claude Code rewinds its file edits to any earlier prompt. It's a genuine safety net — with holes shaped exactly like the mistakes that hurt most: shell commands, database changes, and anything outside the working tree. What's covered, what isn't, and what to use for the rest.
Preventing Cache Stampedes: Coalescing, Locks, Early Expiration, and Stale Serving
When a hot cache key expires, hundreds of requests miss at once and all hit the database. How stampedes happen, and the fixes: singleflight coalescing, distributed locks, probabilistic early recomputation (XFetch), stale-while-revalidate, TTL jitter, and negative caching.
Which Database Should an AI-Built App Use?
The AI will happily pick a database for you — sometimes a file on disk that disappears on the next deploy. What the choice actually is, why Postgres is the right default for almost every app, and the mistakes that lose data.
Backups for Beginners: How to Not Lose Your App's Data
Your code is in Git. Your users' data isn't. What actually needs backing up, the 3-2-1 rule, why a backup you've never restored doesn't count, how often to back up, and a simple backup plan for a small app — including what to do before letting an AI agent near your database.
Your App Needs Background Jobs. Here's the Simplest Way to Add Them.
Sending emails, processing uploads, calling slow AI models, and nightly cleanups don't belong in the middle of a web request. What background jobs and scheduled tasks are, the simplest reliable way to add them — often your existing Postgres database — and the mistakes that make jobs fail silently.
API Pagination: Offset vs Cursor (Keyset) and When Each Breaks
Returning every row works until it doesn't. How offset pagination works and why it gets slow and skips rows, how cursor (keyset) pagination fixes both, how to encode cursors and index for them, tie-breakers, total counts, and a response shape clients can rely on.