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 1g1ICd-00016A-BJ for pgsql-general@arkaria.postgresql.org; Sat, 15 Sep 2018 21:34:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g1ICb-0001BB-Nl for pgsql-general@arkaria.postgresql.org; Sat, 15 Sep 2018 21:34:05 +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 1g1ICb-000197-8n for pgsql-general@lists.postgresql.org; Sat, 15 Sep 2018 21:34:05 +0000 Received: from mail-io1-xd41.google.com ([2607:f8b0:4864:20::d41]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1g1ICY-0002Uw-5a for pgsql-general@lists.postgresql.org; Sat, 15 Sep 2018 21:34:03 +0000 Received: by mail-io1-xd41.google.com with SMTP id q5-v6so8684166iop.3 for ; Sat, 15 Sep 2018 14:34:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:message-id:from:date:in-reply-to:references:to :cc; bh=hmf0QIsXHCy6kztjxE5vNKwipk8ZmXaGJUqhCiibNu0=; b=HWlBlD0YVoSAP/vlOjNc3T8x6aeoqvE0mEU7xrEOTolkDlW/pVHbTAWbbKCipXAddm ttwMWb+WVKwZA5NyXj68WrWxDpzTugejOw7oYZXlqhASvP2oPH0xdPWzRv9BxhgB9aNO d8t9g/g25TPFnRy5ivOq9Hq+OSjQNuF4J9PMn3f79UBPOscffO/ltKFpWJiuoiD7nliO zChKG/KFCW0sKu0qmmQUqtJ4mOk2zJjEu0lTo0PLoJC4yV7FbQF4OBCHb5d2HUQuiPzr v9lbG2TUplV1rjaedeCRariMp5ftXIjnH/ywRM0SDWYPocdFyrKaUsSeIpF9wIp6N9cM bP1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:message-id:from:date :in-reply-to:references:to:cc; bh=hmf0QIsXHCy6kztjxE5vNKwipk8ZmXaGJUqhCiibNu0=; b=IwS+tHjsxHSBaJo01Wh+9LnIFmy+Cqo/YKS83l5V6UNWaS+rs0wXgWgab8QCtR3fUx P+dLbs+VBHpZuUV+j1cZpyVHVh4PJcmPaa3rN2zrpIAZ8Awl92avSD2RSve/qf2U3qzv Bpa8x1DNfVjWT+hNlTaIVhF+sYP8DH95E4jNFPqBnZqbIs01O498aycNNvQvMwczeRsj iNpcqrX/Ma+fOmKlu/hKbriEWAqLTWBLrzm3im/05GREfeG2MckDGHMPVo6xKSpoUK2d yhygueATo5IRCcsJrdiZ6AfhGuV2gBts8xmQommA71ZJwsMQti/+vvNXUafBQfP1UbDK MJyw== X-Gm-Message-State: APzg51D6ohIlxAqKzd1r7VTKhXk669hMV1L9CLmsC7UaI4jf2oLL69UR ulY02EiLFoEj1RdOvpsXfjr2P1AQ X-Google-Smtp-Source: ANB0Vda4ARai5NWfFXRuJ9cgpTZI8mmdFT6ma1q0PoAW92J7V5u7EmaWmSNxHqbM2ElbQmCqPx8Kog== X-Received: by 2002:a6b:b641:: with SMTP id g62-v6mr15311064iof.210.1537047240554; Sat, 15 Sep 2018 14:34:00 -0700 (PDT) Received: from localhost (48.158.155.104.bc.googleusercontent.com. [104.155.158.48]) by smtp.gmail.com with ESMTPSA id q196-v6sm3871045iod.23.2018.09.15.14.34.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Sep 2018 14:34:00 -0700 (PDT) Mime-Version: 1.0 Subject: Re: Vacuum not deleting tuples when lockless Message-ID: <5b9d792caa20125720000002@polymail.io> From: =?UTF-8?q?Mart=C3=ADn_Fern=C3=A1ndez?= Date: Sat, 15 Sep 2018 14:33:49 -0700 In-Reply-To: <87y3c34hnr.fsf@jsievers.enova.com> References: <87y3c34hnr.fsf@jsievers.enova.com> X-Mailer: Polymail To: "Jerry Sievers" , "Tom Lane" Cc: "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary=e1427bcf6b076919a2563297e323c958d67685682a7253294f6af9ba5c61 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --e1427bcf6b076919a2563297e323c958d67685682a7253294f6af9ba5c61 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Tom & Jerry, Thanks a lot for information! On Monday (weekends don't have the same load patterns compared to business = days) I will take a look at `=C2=A0pg_prepared_xacts` that seems to expose = Jerry's suggestion on xacts. Replication slots don't apply to 9.2.X from wh= at I could investigate so I will discard that suggestion.=C2=A0 Feedback setting (hot_standby_feedback) is turned off in all our replicas, = this shouldn't be an issue from what I understood.=C2=A0 Delay setting (vacuum_defer_cleanup_age ) in our master is configured to 0,= =C2=A0, this shouldn't be an issue from what I understood.=C2=A0 Thanks a lot! Best, Mart=C3=ADn On Fri, Sep 14th, 2018 at 11:29 PM, Jerry Sievers = wrote: >=20 >=20 >=20 > Tom Lane < tgl@sss.pgh.pa.us > writes: >=20 > > =3D?UTF-8?q?Mart=3DC3=3DADn_Fern=3DC3=3DA1ndez?=3D < fmartin91@gmail.co= m > writes: > > > >> 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 `vacuum` process is not doing the expected cleanup. > > > >> DETAIL:=E2=80=82=E2=80=82113257 dead row versions cannot be removed ye= t. > > > > 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. >=20 > Oops, didn't notice OP was on 9.2! Presume none, since I don't think we > got rep slots till 9.4 :-) >=20 > > > > regards, tom lane > > > > >=20 > -- > Jerry Sievers > Postgres DBA/Development Consulting > e: postgres.consulting@comcast.net > p: 312.241.7800 >=20 >=20 >=20 > --e1427bcf6b076919a2563297e323c958d67685682a7253294f6af9ba5c61 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8 3D""
Tom &a= mp; Jerry,

Thanks a lot for = information!

On Monday (week= ends don't have the same load patterns compared to business days) I will ta= ke a look at ` pg_prepared_xacts` that seems to expose Jerry's suggest= ion on xacts. Replication slots don't apply to 9.2.X from what I could inve= stigate so I will discard that suggestion. 

<= /div>
Feedback setting (hot_standby_feedback) is turned off = in all our replicas, this shouldn't be an issue from what I understood.&nbs= p;

Delay setting (vacuum_def= er_cleanup_age ) in our master is configured to 0, , this shouldn't be an issue from what I understood.&n= bsp;

Thanks a lot!

Best,
Mart=C3=ADn

<= div class=3D"gmail_quote">
On Fri, Sep 14th, 2018 at 11:29 = PM, Jerry Sievers <gsievers19@comcast.net> wrote:

Tom Lane <tgl@sss.pgh.pa.us> writes:

> =3D?UTF-8?q?Mart=3DC3=3DADn_Fern=3DC3=3DA1ndez?=3D <
fmartin91@gmail.com> writes:
>
>> We are experiencing some `vacuum` issues with a given table
>> (potentially more). When a manual vacuum runs on the given tab= le it
>> seems that the `vacuum` process is not doing the expected clea= nup.
>
>> DETAIL:=E2=80=82=E2=80=82113257 dead row versions cannot be re= moved 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 th= e
> "event horizon" that dead row versions have to fall below before t= hey
> can be removed. That oldest transaction might not be holding any = locks
> at the moment, but it doesn't matter, because in principle it coul= d ask
> to read this table later --- and it should see the table's content= s as
> of its snapshot.
>
> Serializable transactions are worse than repeatable-read transacti= ons
> for this purpose, because the former will keep a snapshot as of th= eir
> start time.
>
> As Jerry mentioned, replication slots can also act like open trans= actions
> for this purpose, though I don't recall how much of that behavior = is
> present in 9.2.x.

Oops, didn't notice OP was on 9.2! Presume none, since I don't think w= e
got rep slots till 9.4 :-)

>
> regards, tom lane
>
>

--=20
Jerry Sievers
Postgres DBA/Development Consulting
e: postgres.consult= ing@comcast.net
p: 312.241.7800


--e1427bcf6b076919a2563297e323c958d67685682a7253294f6af9ba5c61--