Deep Dive
Why an Index Only Scan Still Read the Heap
The plan said Index Only Scan, the buffers said the heap was read anyway, and the win never arrived. Index only is conditional on the visibility map, and…
Query plans, lock contention, deadlocks and the row estimate errors behind most reports that an index is not being used.
Deep Dive
The plan said Index Only Scan, the buffers said the heap was read anyway, and the win never arrived. Index only is conditional on the visibility map, and…
Deep Dive
MVCC gives every transaction an id and keeps old row versions until vacuum says they are dead to everyone. If vacuum falls behind for long enough, the id…
Error Autopsy
The query fails with relation does not exist while the table sits in the schema browser a click away. The table never moved.
Bug Hunt
In production the query took nine hundred milliseconds. Under EXPLAIN it ran in four. The difference was the plan: production ran a cached generic plan…
Error Autopsy
ERROR 40001 looks like a crash and feels like a bug. It is neither. It is the serializable isolation level doing its job, and the only correct client…
Performance
Every index is a second write. On an insert heavy table, nine well meaning indexes turned a fast append into a small transaction against ten data…
Code Review
A migration that is instant on a thousand row table can lock a production table for minutes at scale. Review for locking, backfill strategy and rollback…
Performance
After switching the pooler to transaction mode, the app started failing with 'prepared statement does not exist' at random.
PostgreSQL
Dead tuples that never get reclaimed, a table twice the size of its data, and queries getting slower every week. Here is what blocks vacuum and how to see it.
PostgreSQL
Two transactions each hold what the other wants. Here is how to read the deadlock report, find both statements, and restructure so it cannot happen again.
PostgreSQL
You added the index and the query is still slow. Here is how to read a Postgres query plan properly and find the row estimate error causing it.
Bug Hunt
The dashboard looked right. The numbers were wrong by a few percent every day, and the reason was one implicit conversion in a reporting query.