Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eEuaL-0007or-Km for pgsql-admin@arkaria.postgresql.org; Wed, 15 Nov 2017 10:06:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1eEuaL-0000wk-79 for pgsql-admin@arkaria.postgresql.org; Wed, 15 Nov 2017 10:06:21 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eEuaK-0000wT-G6 for pgsql-admin@postgresql.org; Wed, 15 Nov 2017 10:06:20 +0000 Received: from mx2.mailbox.org ([80.241.60.215]) by makus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eEuaG-0004m6-7d for pgsql-admin@postgresql.org; Wed, 15 Nov 2017 10:06:19 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 1EB334CE33; Wed, 15 Nov 2017 11:06:12 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id 68REfAuIQMdA; Wed, 15 Nov 2017 11:06:06 +0100 (CET) Message-ID: <1510740365.2424.22.camel@cybertec.at> Subject: Re: Vacuum not removing dead tuples From: Laurenz Albe To: Rui DeSousa , pgsql-admin@postgresql.org Date: Wed, 15 Nov 2017 11:06:05 +0100 In-Reply-To: <7D8ED7AF-E189-4FA2-BB6D-FC9E8A127E28@icloud.com> References: <7D8ED7AF-E189-4FA2-BB6D-FC9E8A127E28@icloud.com> Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org 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