Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g1098-0005uM-EQ for pgsql-general@arkaria.postgresql.org; Sat, 15 Sep 2018 02:17:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g1095-0005zf-Rr for pgsql-general@arkaria.postgresql.org; Sat, 15 Sep 2018 02:17:15 +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.89) (envelope-from ) id 1g1095-0005zX-GV for pgsql-general@lists.postgresql.org; Sat, 15 Sep 2018 02:17:15 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g108y-0002zS-RM for pgsql-general@lists.postgresql.org; Sat, 15 Sep 2018 02:17:14 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w8F2H5JC013362; Fri, 14 Sep 2018 22:17:05 -0400 From: Tom Lane To: =?UTF-8?q?Mart=C3=ADn_Fern=C3=A1ndez?= cc: "pgsql-generallists.postgresql.org" Subject: Re: Vacuum not deleting tuples when lockless In-reply-to: <5b9c3f8aaa20125720000001@polymail.io> References: <5b9c3f8aaa20125720000001@polymail.io> Comments: In-reply-to =?UTF-8?q?Mart=C3=ADn_Fern=C3=A1ndez?= message dated "Fri, 14 Sep 2018 16:15:43 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <13360.1536977825.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 14 Sep 2018 22:17:05 -0400 Message-ID: <13361.1536977825@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =3D?UTF-8?q?Mart=3DC3=3DADn_Fern=3DC3=3DA1ndez?=3D w= rites: > We are experiencing some `vacuum` issues with a given table (potentially= more). When a manual vacuum runs on the given table it seems that the `va= cuum` process is not doing the expected cleanup. > DETAIL:=E2=80=82=E2=80=82113257 dead row versions cannot be removed yet. Locks don't really have anything to do with that: what does matter is how old is the oldest open transaction, because that determines the "event horizon" that dead row versions have to fall below before they can be removed. That oldest transaction might not be holding any locks at the moment, but it doesn't matter, because in principle it could ask to read this table later --- and it should see the table's contents as of its snapshot. Serializable transactions are worse than repeatable-read transactions for this purpose, because the former will keep a snapshot as of their start time. As Jerry mentioned, replication slots can also act like open transactions for this purpose, though I don't recall how much of that behavior is present in 9.2.x. regards, tom lane