pgvector Index Tuning: HNSW vs IVFFlat, Explained

pgvector Index Tuning: What Actually Matters If you're running vector search on Postgres with pgvector, three decisions determine whether you get a search service you can reason about or one that quietly lies to you: which index type you pick, how you tune it, and how you handle filtered queries. Get the first two wrong …

Read more

Postgres Is Down: A 5-Minute Triage Tree

Intuition is what gets you a two-hour outage. You "have a feeling" it's the connection pool, you bounce the app tier, it doesn't help, and now you've lost fifteen minutes plus whatever evidence was sitting in the app logs. The fastest path back is a fixed sequence run in a fixed order: disk, connections, OOM, …

Read more

pg_cancel_backend vs pg_terminate_backend: Full Runbook

pg_cancel_backend vs pg_terminate_backend: a DBA's runbook It was 02:14 on a Tuesday. A migration job fired an UPDATE against a 40M-row orders table without a WHERE clause narrow enough to matter, took an exclusive row lock on half of it, and the checkout path started queueing behind it. PagerDuty went off at the twelve-minute mark. …

Read more

Postgres TOAST: A Practical Storage Checklist

Postgres moves any row value over roughly 2KB (TOAST_TUPLE_THRESHOLD) out of the main table and into a hidden pg_toast table, compressing or splitting it along the way. That's TOAST — The Oversized-Attribute Storage Technique — and it's why a table full of jsonb or text columns can behave very differently from a table of integers, …

Read more

Postgres Row-Level Security: A Multi-Tenant Playbook

What Postgres Row-Level Security Actually Does Row-level security (RLS) lets Postgres filter and check rows per query, per role, based on a policy you define in SQL. Instead of adding WHERE tenant_id = :current_tenant to every query in every service, you write the rule once and the database enforces it — on your API, your …

Read more

Fix “No pg_hba.conf Entry for Host” in Postgres

"No pg_hba.conf Entry for Host": What the Error Actually Means and How to Fix It If Postgres just handed you FATAL: no pg_hba.conf entry for host "10.0.2.15", user "app", database "orders", SSL off, here's the short version: your connection reached the server, but no line in pg_hba.conf matched the client address, database, user, and encryption …

Read more

Postgres Wait Events: A Practical Triage Guide

Your query is slow. Postgres already told you why. The usual sequence when something goes sideways: someone pastes a slow query into Slack, someone else runs EXPLAIN, a third person SSHes into the box and stares at top. Forty minutes later you know the plan is fine and the CPU is at 30% and you …

Read more

Postgres Replication Lag Is Four Numbers, Not One

Postgres Replication Lag Is Four Numbers, Not One The page comes in at 03:14: "replica is lagging." That sentence tells you nothing useful. Lagging where? Postgres doesn't have a lag counter. It has a pipeline with four measurable checkpoints, and the primary exposes all four side by side in pg_stat_replication. Know which gap is growing …

Read more