TL;DR: A session in the idle in transaction state has opened a transaction and is doing nothing, usually because application code is waiting on something else (an HTTP call, a user, a forgotten commit ). It keeps its locks and pins the oldest visible transaction, so migrations queue behind it and vacuum cannot clean up dead rows. Find the sessions in pg_stat_activity , fix the code path that holds a transaction open across slow work, and set idle_in_transaction_session_timeout as a backstop.
Behavior described here is accurate for current Postgres releases as of late 2026; the parameters I mention exist in the versions noted below.
How do I know this is my problem?
The symptoms are indirect, which is why this one takes people days. A migration that should take milliseconds hangs on ALTER TABLE . Table bloat grows even though autovacuum is running.…