
PostgreSQL rarely falls over. It slows down, quietly, for reasons that were planted weeks before. We planted six of them on PostgreSQL 16, 17 and 18, while a pgbench load kept running, and watched them with DBFrog.
This is post 2 of a series in which we break databases on purpose and watch them with DBFrog. Post 1, the DBFrog database monitoring introduction, describes the tool and the test bench.
What we broke#
- A table,
hc_bloat, with autovacuum switched off, 200,000 rows, every row updated once and half of them twice. Never analyzed. - A unique index built with
CREATE INDEX CONCURRENTLYon a column that has duplicates. The build fails and leaves an invalid index behind. - A
smallintkey whose sequence stands at 32,101 of 32,767. - A session that runs
BEGIN, updates one row, and then does nothing. - A second session that wants the same row.
- A few sorts with
work_memset to 64 kB, so they spill to disk.
The forgotten transaction#
This is the most common production incident of the list, and the least visible one. An application opens a transaction, hits an error path or a slow API call, and never commits.
Drilldowns, Sessions. The two rows at the top are the planted pair.
The diagram shows it first: under Backend Processes, “Idle in transaction” and “Waiting: lock” each count one, and the component turns amber. The Sessions drilldown names them. Process 378759 is idle in transaction for 47 seconds. Process 378760 is active, waits on Lock: transactionid, and has blocked_by 1.
Drilldowns, Blocking locks. One line: who waits, for how long, and who holds the lock.
The Blocking locks tab puts both on one line, with both statements. Here a DBA has what they need: the blocker is idle, so no query will finish and release the lock by itself. Someone has to end that session or fix the code path that left it open.
The damage you do not see#
The lock is the visible half. The other half is in the Dead tuples tab.
Drilldowns, Dead tuples. Three tables are in trouble, for two different reasons.
hc_bloat has 200,000 live rows and 299,989 dead ones, and last_vacuum says “never”. That is the table we planted. But look at the two below it: pgbench_tellers is 99% dead rows and pgbench_branches 99.9%. We did not touch those. Autovacuum ran on them minutes earlier and could not remove anything, because the forgotten transaction still holds a snapshot that might need the old row versions. One idle session makes every busy table on the server grow.
The 24-hour picture in post 1 shows the same thing from further away: four hours of red on the time slider while that session stayed open.
What the scan found#
Insights are the slow checks: not “what is wrong this second” but “what will hurt you”. On PostgreSQL 18 the scan listed 24 findings.
Insights. One critical finding, four warnings, and the suggested SQL one click away.
The planted problems came out on top:
- Critical: sequence
public.hc_ticket_id_seqhas used 98% of its range. When it runs out, every insert that needs a new id fails. The fix is a change tobigint, and it is much easier to schedule than to do during an outage. - Warning: 1 index is invalid:
public.hc_bloat_k_unique. Queries cannot use it, and every write still maintains it. - Warning: autovacuum is switched off for 1 table.
- Warning: 1 table with more than 10,000 rows has never been analyzed. Without statistics the planner guesses.
- Warning: sessions waited for the same lock holder 218 times since the evening before, with the table (
pgbench_branches), the longest wait (56 seconds) and both statements. This one is not planted. It is the chaos script, and DBFrog kept count. - Info: 3 tables have no primary key, among them
hc_bloat.
The scan also reported things about the test bench itself that we had not thought about: the tool connects as a superuser where pg_monitor would do, SSL is off, and there is no statement_timeout for any role. All three are fair.
What we did not see#
Two planted items are not in our screenshots: the duplicate index pair on hc_bloat and the foreign key without an index. The list had 13 more entries under Tuning that we did not capture, so we cannot say here whether they were among them. We prefer to leave that open than to claim it.
One limit is stated on the screen itself: “Tables in the connected database only”. DBFrog examines tables and indexes in the database it connects to. If your application data lives in another database of the same server, connect DBFrog to that one.
The same on Supabase and other managed PostgreSQL#
Nothing in this post needs access to the machine. Idle transactions, dead rows, invalid indexes, sequences and lock waits all come from catalog views that a role with pg_monitor can read, and managed services expose them. So the findings above are the kind you can expect on Supabase, RDS or Cloud SQL as well. We did not test it there; the test bench is containers. Two points to plan for: host CPU and disk come from the provider’s dashboard, and on Supabase the direct connection is the right one for a monitoring tool, not the transaction pooler.
Next in the series: MySQL locks, full scans and the table nobody indexed.


