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

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 Apps: 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 …

Why Your FastAPI Endpoint Blocks the Event Loop
“Just make it async def” is the advice every FastAPI developer hears first, and it’s the reason so many production incidents start …

ai-memory: A Complete Guide to Giving AI Coding Agents Persistent, Cross-Tool Memory
You quit Claude Code mid-task after four hours of back-and-forth — architecture decisions made, three approaches tried and abandoned, one open …