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 1g0xJh-0005tz-A2 for pgsql-general@arkaria.postgresql.org; Fri, 14 Sep 2018 23:16:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g0xJf-0001fc-CO for pgsql-general@arkaria.postgresql.org; Fri, 14 Sep 2018 23:15:59 +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 1g0xJe-0001fD-NG for pgsql-general@lists.postgresql.org; Fri, 14 Sep 2018 23:15:58 +0000 Received: from mail-it0-x243.google.com ([2607:f8b0:4001:c0b::243]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1g0xJb-0007Zx-I5 for pgsql-general@lists.postgresql.org; Fri, 14 Sep 2018 23:15:56 +0000 Received: by mail-it0-x243.google.com with SMTP id h23-v6so4585456ita.5 for ; Fri, 14 Sep 2018 16:15:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:date:message-id:subject:from:to; bh=rvy7Cw/lhg/c5PACt+Ct66UaZQVa/nb45J1thJbecgE=; b=FqfCZ6ObfWpUXKFHXCmx9Vf4OdAoEWvUQ14wm60zZpqEmCVTS9RcY5FxfTr/+RUGP2 iN7H/a0iG0ONSiuhji8fO33PoJL0msTAR9C4j5PxwhU5FxbZpdav0jRADe84KQHhEHFS VC3wRH6ehCKTAPfhsusbwBSZuviRBF43oMRq6Fuww2sshFC9mA0xhn69FBzGVgn6Jo/Y B/Q01dN/oNXG0mG/wpNJCwu09+7nngMrmBUAwJ9LrvSuCZ2oim0O6ibu/+RQi6mzOplV Tt1aN34Q+C8P22rSiDvFnDTAgpbG35bMtSxT4rdA1L8L01XCukrNXDgjOW0zjtklSdpV /QxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=rvy7Cw/lhg/c5PACt+Ct66UaZQVa/nb45J1thJbecgE=; b=oAxDcfOjeefYfOvvFoPQyz575qLA5jENENd5yQbBPK086vHmGdZb1Z45JRCJRCTOyM n4VVt3uCg+VfsRlUHnTAiQlLVwuUCM3VB1tyU4FOCkJHMmxuGqzADjuHRxKLiqN4ub1o gdOetfbIKLGfsTauZhM8+AbLEgMDerxjYEESwxZEjmS4nr1S3lc8n27MRsVc0YfzmARp 4tkWQ88XFXd1s/wrGilnnMfsyKMoqC2ScN79iOR0002NNF0OesKG2dI+7aotcU/XVNJW 2HwU8uZHK3f/DroYQKo/y9OsmcUNcKYIapEXToQ8lc1NLfwIA8UhMq1FdqRRIVQ3/m1v dzlA== X-Gm-Message-State: APzg51D93xykJLssqsAE3Jvzs9DzFqgSCO42N637VuKh8ea2VvpUfXHB OHuIFQemh4cXlgAw6YSbFe2jlb/z X-Google-Smtp-Source: ANB0VdawCkpfIjpnPIw9bR0vfbkVnlAs4CTacQlpDuxMid23E/0sqBZIb1irjNd7Yl6wZGZB4KsBPg== X-Received: by 2002:a24:d286:: with SMTP id z128-v6mr4233274itf.14.1536966953432; Fri, 14 Sep 2018 16:15:53 -0700 (PDT) Received: from localhost (48.158.155.104.bc.googleusercontent.com. [104.155.158.48]) by smtp.gmail.com with ESMTPSA id w196-v6sm188344itb.9.2018.09.14.16.15.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Sep 2018 16:15:52 -0700 (PDT) Mime-Version: 1.0 Date: Fri, 14 Sep 2018 16:15:43 -0700 X-Mailer: Polymail Message-ID: <5b9c3f8aaa20125720000001@polymail.io> Subject: Vacuum not deleting tuples when lockless From: =?UTF-8?q?Mart=C3=ADn_Fern=C3=A1ndez?= To: "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary=f290fdd3321828ac356d1992a42a04602b9eb5e4868787627507e8b60c67 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --f290fdd3321828ac356d1992a42a04602b9eb5e4868787627507e8b60c67 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Hello, We are experiencing some `vacuum` issues with a given table (potentially mo= re). When a manual vacuum runs on the given table it seems that the `vacuum= ` process is not doing the expected cleanup. ``` DETAIL:=E2=80=82=E2=80=82113257 dead row versions cannot be removed yet. ``` I've been investigating the reasons for vacuum not being able to do it's wo= rk and I found that generally the problem is caused by open transactions re= ferencing the dead tuples. I also found that locking can be a problem as we= ll. I did check that no long running transaction was happening and=C2=A0no lock= ing was happening=C2=A0before running `vacuum` on the given table. I used this query to check the locks: ``` SELECT query, state,locktype,mode FROM pg_locks JOIN pg_stat_activity =C2=A0 USING (pid) WHERE relation::regclass =3D 'my_table'::regclass =C2=A0 AND granted IS TRUE; ``` I'm not sure where else to look for a potential issue that could be causing= this problem. A few days back we had to use re_pack on the given table to = solve our performance issues. Important thing to clarify is that we are using postgresql 9.2.24 Thanks in advance! Best, Mart=C3=ADn --f290fdd3321828ac356d1992a42a04602b9eb5e4868787627507e8b60c67 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8 3D""
Hello,=

We are experiencing some `v= acuum` issues with a given table (potentially more). When a manual vacuum r= uns on the given table it seems that the `vacuum` process is not doing the = expected cleanup.

```
DETAIL:=E2=80=82=E2=80=82113257 dead row ve= rsions cannot be removed yet.
```

I've been investigating the rea= sons for vacuum not being able to do it's work and I found that generally t= he problem is caused by open transactions referencing the dead tuples. I al= so found that locking can be a problem as well.

I did check that no long running transaction was happen= ing and no locking was happeni= ng before runnin= g `vacuum` on the given table.

I used this query t= o check the locks:

```
SELECT query, state,locktype,mode
FROM pg_locks
JOIN pg_stat_activity
  USING= (pid)
WHERE relation::regclass =3D 'my_table'::regclass
  AND granted IS TRUE;
```

I'm not sure where else to lo= ok for a potential issue that could be causing this problem. A few days bac= k we had to use re_pack on the given table to solve our performance issues.=

Important thing to clarify = is that we are using postgresql 9.2.24

Thanks in advance!

Best,
Mart=C3=ADn
--f290fdd3321828ac356d1992a42a04602b9eb5e4868787627507e8b60c67--