Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4mcD-0006dm-CO for pgsql-general@arkaria.postgresql.org; Fri, 24 Jun 2022 16:57:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o4mcC-0001Da-9B for pgsql-general@arkaria.postgresql.org; Fri, 24 Jun 2022 16:57:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4mcB-0001DR-VF for pgsql-general@lists.postgresql.org; Fri, 24 Jun 2022 16:57:03 +0000 Received: from mail-yw1-x1134.google.com ([2607:f8b0:4864:20::1134]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o4mc4-0007qr-TH for pgsql-general@lists.postgresql.org; Fri, 24 Jun 2022 16:57:03 +0000 Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-3137316bb69so30369067b3.10 for ; Fri, 24 Jun 2022 09:56:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=percona.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=V+7dDJwhTWCdXuV1yc0VPMoZjhJJIorvBI237kqmktc=; b=WVfEfiCHoclxKDXTwMnbXSu/07s+KC4hiau+ZFsTAzMN3ggmAPSHImvSaEzYPzzc6g 5WPxHdco444JnlUnEvYJ/b8DqOwbEco8Ci4+h2Na2T577dq87RyhchmpkjxW3CdpLbJo zwf5mPnc7ScsPoFgb/2q8AGiudm0pG2HuIcJg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=V+7dDJwhTWCdXuV1yc0VPMoZjhJJIorvBI237kqmktc=; b=Q7X2gNvAeln6+TLjUVu4Di1zVOO0xzy6ohcTdHrjmNE3lrJC4qCZklL0SbXzyJe0Nj 7yir4VJ4cSkYdoo22ikiN0pdNp6IrA5CoddVa/rd1xGT2b+lWppIDp5dV7hNIuwKvJqx ZCVBLL0VFTufR84B03GxnYWzEnaVMxD0r3B1C2jcrr+8tVPxaLXTgXpQSX871wZLbFUV CcNkA65QTZuikHs+Sfqgaeb9N9uNsb4pcWO2Vab7yorWv0YUH5Eb/VpM300qcE5oCD3P 8vZ8+lQC/IV83IePbJqLCnfsWwsd+a1Ab26tONYdBs3nASU9eNwYnxP9IF22EyEx3DpO IN1w== X-Gm-Message-State: AJIora+ESVmj2SLnE7+Fi55Txhkz05KaDlfICMszfwnd/ExPOgomt1ox 4hgaiCAbRY651zXtiUTTZTkn49pFvPlp7aVkwfmt68BJZsYa X-Google-Smtp-Source: AGRyM1trJ7SHiFrzT52Zj6OwsOyCwXrH4IEkmcHgplNQbvizFv2qdXErCNJ3cT1G7B2ztCd1cfcPTLi2f9eIM+sHPGs= X-Received: by 2002:a81:10c6:0:b0:318:11df:d3c2 with SMTP id 189-20020a8110c6000000b0031811dfd3c2mr18063128ywq.104.1656089814992; Fri, 24 Jun 2022 09:56:54 -0700 (PDT) MIME-Version: 1.0 References: <9babf7514fb0d98d55042552def28adf9eab9824.camel@cybertec.at> In-Reply-To: <9babf7514fb0d98d55042552def28adf9eab9824.camel@cybertec.at> From: Ninad Shah Date: Fri, 24 Jun 2022 22:26:44 +0530 Message-ID: Subject: Re: Automatic autovacuum to prevent wraparound - PG13.5 To: Laurenz Albe Cc: Mauro Farracha , pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="00000000000023a46005e23475d3" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000023a46005e23475d3 Content-Type: text/plain; charset="UTF-8" Frankly speaking, Aurora PostgreSQL's behaviour is quite unpredictable. In our case, the autovacuum was not even getting triggered in spite of crossing the autovacuum_freeze_max_age. Finally, the database went down abruptly, which resolved the issue. Thanks, Ninad On Wed, Jun 15, 2022 at 7:57 PM Laurenz Albe wrote: > On Wed, 2022-06-15 at 12:13 +0100, Mauro Farracha wrote: > > Have recently upgraded from PG10 to PG13.5 and would like to understand > the reason why we > > are seeing triggered autovacuum to prevent the wraparound while all > the metrics are still > > far off from the multixact/freeze max ages defined. And inclusive there > was one time where > > it was triggered as aggressive. > > > > Some background: > > - autovacuum_freeze_max_age: 400M > > - autovacuum_multixact_freeze_max_age: 800M > > - the activity is mostly insert intensive in one particular table (60M > daily) > > - the team execute vacuum freeze verbose every day at night to keep the > multixact ids down > > - we generally reach near 70M mxids before running vacuum freeze at night > > - the postgresql is Aurora > > > > The scenario: > > - Out of nowhere (during the weekend), without database activity load or > batches running, > > with previous nightly run of vacuum freeze, in the middle of the day, > with xids and mxids > > below 20M we are seeing autovacuum being triggered to prevent > wraparound. > > > > My question is why this is occurring, which condition might be > responsible for this behaviour? > > A long-running transaction or a prepared transaction. > Or an abandoned replication slot with an old "xmin". > > That would be the answer for PostgreSQL. It might apply to Amazon Aurora, > unless they > changed the behavior there. Perhaps ask Amazon. > > Yours, > Laurenz Albe > -- > Cybertec | https://www.cybertec-postgresql.com > > > --00000000000023a46005e23475d3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Frankly speaking, Aurora PostgreSQL's behaviour is qui= te unpredictable.
In our case, the autovacuum was not even getting trig= gered in spite of crossing the autovacuum_freeze_max_age. Finally, the data= base went down abruptly, which resolved the issue.


Thanks,
Ninad

On Wed, Jun 15, 2022 at 7:57 P= M Laurenz Albe <laurenz.albe= @cybertec.at> wrote:
On Wed, 2022-06-15 at 12:13 +0100, Mauro Farracha wrote:
> Have recently upgraded from PG10 to PG13.5 and would like to understan= d the reason why we
> are seeing triggered autovacuum to prevent the wraparound while all th= e=C2=A0metrics are still
> far off from the multixact/freeze max ages defined. And inclusive ther= e was one time where
> it was triggered as aggressive.
>
> Some background:
> - autovacuum_freeze_max_age: 400M
> - autovacuum_multixact_freeze_max_age: 800M
> - the activity is mostly insert intensive in one particular table (60M= daily)
> - the team execute vacuum freeze verbose every day at night to keep th= e multixact ids down
> - we generally reach near 70M mxids before running vacuum freeze at ni= ght
> - the postgresql is Aurora
>
> The scenario:
> - Out of nowhere=C2=A0(during the weekend), without database activity = load or batches running,
>=C2=A0 =C2=A0with previous nightly run of vacuum freeze, in the middle = of the day, with xids and mxids
>=C2=A0 =C2=A0below 20M we are seeing autovacuum being triggered to prev= ent wraparound.
>
> My question is why this is occurring, which condition might be respons= ible for this behaviour?

A long-running transaction or a prepared transaction.
Or an abandoned replication slot with an old "xmin".

That would be the answer for PostgreSQL.=C2=A0 It might apply to Amazon Aur= ora, unless they
changed the behavior there.=C2=A0 Perhaps ask Amazon.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com


--00000000000023a46005e23475d3--