pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Rui DeSousa <rui.desousa@icloud.com>
To: pgsql-admin@postgresql.org
Subject: Re: Vacuum not removing dead tuples
Date: Wed, 15 Nov 2017 11:06:05 +0100
Message-ID: <1510740365.2424.22.camel@cybertec.at> (raw)
In-Reply-To: <7D8ED7AF-E189-4FA2-BB6D-FC9E8A127E28@icloud.com>
References: <7D8ED7AF-E189-4FA2-BB6D-FC9E8A127E28@icloud.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.

Yours,
Laurenz Albe


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



view thread (3+ messages)  latest in thread

Message-ID: <1510740365.2424.22.camel@cybertec.at>
Permalink:  ../1510740365.2424.22.camel@cybertec.at/
Also on:    postgresql.org/message-id/1510740365.2424.22.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: laurenz.albe@cybertec.at, rui.desousa@icloud.com
  Subject: Re: Vacuum not removing dead tuples
  In-Reply-To: <1510740365.2424.22.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox