Re: Vacuum not removing dead tuples

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Rui DeSousa <rui(dot)desousa(at)icloud(dot)com>, pgsql-admin(at)postgresql(dot)org
Subject: Re: Vacuum not removing dead tuples
Date: 2017-11-15 10:06:05
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

Rui DeSousa wrote:
> Is there a reason vacuum will not remove dead tuples other than the usual suspects?
> There are no two phase transactions and even after a restoring the database
> from binary backup with nothing connect to the restored instance;
> vacuum still does not remove the dead tuples.

There are three possibilities:

1) Active transactions:

SELECT backend_xmin, xact_start, datname, pid, query
FROM pg_stat_activity
WHERE state <> 'idle'
ORDER BY xact_start;

2) Prepared transactions:

SELECT xid, prepared
FROM pg_prepared_xacts;

3) Lagging replication slots:

SELECT xmin, slot_name, active, active_pid
FROM pg_replication_slots;

The "xid" columns will tell you which tuples VACUUM can
remove: Any tuple with "xmax" less than this are fair game.

Laurenz Albe

In response to


Browse pgsql-admin by date

  From Date Subject
Next Message Joan Luc Labòrda 2017-11-15 11:50:28 Re: Upgrade 9.5 cluster with non default data directory with checksum
Previous Message Johannes Truschnigg 2017-11-15 09:32:16 Re: recreating point-in-time recovery when tables are in non-default tablespace