--- title: "PgBouncer Transaction Mode: Pool Sizing Math and the Prepared Statement Trap" published: true description: "Deep dive into PgBouncer transaction vs session mode tradeoffs, the prepared statement invalidation bug that hits production, pool sizing formulas, and a benchmark comparison of…
The problem: everyone clicks at the same moment Selling tickets looks like basic CRUD. A user picks seats, pays, gets a ticket. Insert a row, send an email, done. Then a popular event goes on sale. Hundreds of people hit "Buy" within the same few seconds, and a lot of them want the same front rows.…
Slow Postgres, part 3 of 8. The SQL and raw numbers for every test are on GitHub . PostgreSQL 18, sampled every 5 seconds. Gaps: pgbench runs. A retention job marked 463,418 of five million orders archived , a status ANALYZE had never seen, so Postgres estimated 1 row for it. An endpoint listing…
Amazon Aurora PostgreSQL is AWS's managed PostgreSQL-compatible database, with compute instances that share a distributed storage volume. An operator reported a \$6,000 monthly bill for a roughly 5 TB Aurora PostgreSQL database. Roughly \$5,000 of the bill came from 22 billion storage I/O requests…
How long does a PostgreSQL cluster stay without a primary when the primary dies without warning? Not a clean shutdown, not a switchover: the whole node gone at once while an application keeps writing. We measured it on a real Patroni cluster with the default settings. The application went 24.8…
You can’t rely on a flat vector store when your data lives in relational tables. By the end of this guide you’ll have a live Node.js service that pulls context from Aurora Serverless v2, crafts a prompt, and lets Claude answer like it’s reading the docs straight from your database. Why RAG Needs a…
Email verification looks like a small feature: create a token, send a message, and mark the account as verified when the user clicks it. In a real REST API, the click can arrive twice, arrive after expiry, or race with a retry from a mobile client. If the endpoint treats every request as a fresh…
Over the last few months I helped a team running a large B2B ERP on PostgreSQL (RDS for the main database, plus a few self-hosted PostgreSQL 17 servers). Almost every "the database is slow" ticket turned out to be something other than load. CPU was fine, disk was fine, and users were still waiting.…
Root Causes and Resolution Patterns for Deadlocks Caused by Row-Level Lock Contention in PostgreSQL 1. Environment-Induced Failure During QA Execution During the implementation and QA testing phase of this project, we encountered a critical environment-related failure before the database…