Writing & Ideas
Thoughts on AI engineering, LLM systems, and building software that scales.

Choosing a Python Task Queue: Celery, Dramatiq, RQ, arq
Most teams don’t choose a Python task queue — they inherit one. Someone bootstrapped the project three years ago, Celery was the obvious name, …

Zero-Downtime Postgres Migrations
The migration that takes down production is almost never the one anyone was worried about. It’s rarely a DROP TABLE — everyone reviews those …

pgvector or a Dedicated Vector Database?
Every “pgvector vs Pinecone” comparison online eventually turns into a benchmark chart of raw queries-per-second at some fixed vector …

Connection Pooling for Python: PgBouncer and Async Pools
“Just add PgBouncer in front of it” is the reflexive answer to almost any Postgres connection problem, and it’s right often enough …

N+1 Queries in Django ORM: Find Them, Then Kill Them
The Django ORM’s biggest strength is also its biggest trap: order.customer.name reads like a free attribute access, but behind that dot is a …

Picking the Right Postgres Index: B-tree, GIN, GiST, BRIN
Ask most developers what a Postgres index is and the answer is “a B-tree that makes WHERE clauses fast.” That’s true for maybe 80% …

Reading EXPLAIN ANALYZE Without Guessing
Most developers run EXPLAIN ANALYZE the same way they run a stack trace on an error they don’t understand — paste it into the query, get a wall …

Streaming in FastAPI: SSE vs WebSockets vs Polling
Every team building an LLM-backed feature hits the same decision point: the model streams tokens as they’re generated, and the frontend needs to …

Async SQLAlchemy Sessions in FastAPI, Done Right
sqlalchemy.exc.MissingGreenlet: greenlet_spawn has not been called is the error that greets almost every team migrating a FastAPI app from sync …

FastAPI BackgroundTasks vs Celery: Picking the Right One
BackgroundTasks looks like it solves the same problem Celery does — run some work after the response goes out, without making the user wait for it. …

FastAPI Dependency Injection: Patterns and Anti-Patterns
Depends gets introduced in every FastAPI tutorial as “how you get the current user,” and most developers never look past that one use …

FastAPI Project Structure That Survives Growth
Every FastAPI project starts the same way: one main.py file with a handful of routes, a Pydantic model or two, and a database call inline in the …