Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vEIsR-009cxU-LE for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Oct 2025 02:59:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vEIsQ-005Mro-Ah for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Oct 2025 02:59:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vEIsP-005Mrf-Ub for pgsql-hackers@lists.postgresql.org; Thu, 30 Oct 2025 02:59:01 +0000 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vEIsM-004zYL-1W for pgsql-hackers@postgresql.org; Thu, 30 Oct 2025 02:59:00 +0000 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-63c4f1e7243so778074a12.3 for ; Wed, 29 Oct 2025 19:58:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761793137; x=1762397937; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=uEwtitvNmSKamEstkec+0tgdNH06AQzvyg1TVTCTn6k=; b=hltzgcxsDFmCr8/vtusVn2WFMa9HcMj9nKfqaf9t16SQIH2gKVWi2ZQM068QTr/TBL 6m18lN2CaForGf0JEXVnYxOUBlno0q+YNGnlr0Edukr/xK1/0BFTkentkEYkZryq8MR/ EwPjW3xX1fWVcb3ciqsqAjvy2zC0ifKV3qJPlPiYuTQc20SpCGozyXoGalxTPjIXyjcm RpSJqZp/VEQVM1gibMpyaZgCGYuv49Xq4x17pSh8H59eRcu2Mqg7lZTdpgMFFeFWqUog sGoqAvy2Qf+gzRmyX5FBPVTzYpppB5gqWHpAoV0dAVrknK80PkhTGKcR8vLemNY6hY2T RyyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761793137; x=1762397937; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uEwtitvNmSKamEstkec+0tgdNH06AQzvyg1TVTCTn6k=; b=fQaEhOrlp+jAVqyQ257qWJsNHzZWMSGeRkyIYHEgEN4+ka3Z6Csa0qStuj7Y7yr7nr K2LL076VfQ866HR+aWI9I1ZuTWBcZaG+db0GZ5B8OCIA4a0aa3GtNfe0x5c6azpxoyOX oI83EswKZPwUW+TydMYxgIwKvF+xqnagO1usOMPTXUB+vbf6bKgzI/5GtpZJfZLf/Z/1 kFbS9wTxbTSc3nDc/m0PMtLhD64MtqR8kK8oL2kvnH6Q51frHfaCcuZvRXOEYjEVy8nd RSobWISk/I4tCd2F9QVzD2DXLic2sjESKDoYPod2bX5IoejuRtfH/rpx4pXZcieju/Ri NMzQ== X-Forwarded-Encrypted: i=1; AJvYcCU8Wii3vh5yYuWc731PLYg+mMPdWJ6/ZWx75fcRS4fmt0w7mbCifG6AqydvVQW3oYIHclWNhsh+m/sFqTQS@postgresql.org X-Gm-Message-State: AOJu0YwW2iyDN74xagquggTcFzhJaXVHv3m5MrEmGpCsCDwPd+WAjSo1 f7wSkZjafKOEH0rIO3EmkN0XPmqqKwEeoWrQyWL8FiwWzqJr3D3nKZlbJOWC4leD06LmIypWF8m 4AwhJ1+F1GjUOfTUyX3bdxKqb8wfW0GI= X-Gm-Gg: ASbGncvu+EryRnuAkmUjOTyO3XkcefiY4fBJ7XLZRPwV2E71MzZ5ag4/CGXWbnrAhMS gjBE8ui8GEuehU09Ov00C0JHgja1c70X0TX02JX6QwGiw+wqJIqKpGZd5xEa0HKiKF1nh7Z3WCB d3Lem+tx0Hf9yROeNyIMAmBVE9QI3sAy3vIx5TodQSEParR3E/Qn3Sjx6wKmGHn1+nqa78IRLwm FBnnER9NDwzeR3Pn+L7j0ueuxrw0c7vQ5PjhErRqd5RySRJXw14PaDnVcI= X-Google-Smtp-Source: AGHT+IEkeVlbZTN2ZB800k7ZzYY5R4bz+ClWLorOVY8jKR+Xn0lUVeNCSB3K2rUtKzAfGyhfwodCTf+dL1Ix27YuGNI= X-Received: by 2002:a05:6402:42cf:b0:63c:5d27:7ed7 with SMTP id 4fb4d7f45d1cf-640443afec1mr3697552a12.30.1761793137042; Wed, 29 Oct 2025 19:58:57 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: wenhui qiu Date: Thu, 30 Oct 2025 10:58:44 +0800 X-Gm-Features: AWmQ_bnpTPoHXNRuOvSzt-a3TxcEHP4F0q__xbA5ucvDkvifgVnF2mEfj4TGRLE Message-ID: Subject: Re: another autovacuum scheduling thread To: Nathan Bossart Cc: Sami Imseih , David Rowley , Robert Haas , Jeremy Schneider , pgsql-hackers@postgresql.org Content-Type: multipart/alternative; boundary="00000000000019e69d0642576e4b" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000019e69d0642576e4b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable HI Nathan > That approach would begin aggressively scaling the priority of tables > sooner, but I don't know if that's strictly better. In any case, I'd lik= e > to avoid making the score calculation too magical. In fact, with the introduction of the vacuum_max_eager_freeze_failure_rate feature, if a table=E2=80=99s age still exceeds more than 1.x times the autovacuum_freeze_max_age, it suggests that the vacuum freeze process is not functioning properly. Once the age surpasses vacuum_failsafe_age, wraparound issues are likely to occur soon.Taking the average of vacuum_failsafe_age and autovacuum_freeze_max_age is not a complex approach. Under the default configuration, this average already exceeds four times the autovacuum_freeze_max_age. At that stage, a DBA should have already intervened to investigate and resolve why the table age is not decreasing. Thanks On Thu, Oct 30, 2025 at 12:07=E2=80=AFAM Nathan Bossart wrote: > On Wed, Oct 29, 2025 at 10:24:17AM -0500, Sami Imseih wrote: > > I think we do need some documentation about this behavior, which v6 is > > still missing. > > Would you be interested in giving that part a try? > > > Another thing I have been contemplating about is the change in > prioritization > > and the resulting difference in the order in which tables are vacuumed > > is what it means for workloads in which autovacuum tuning that was > > done with the current assumptions will no longer be beneficial. > > > > Let's imagine staging tables that get created and dropped during > > some batch processing window and they see huge data > > ingestion/changes. The current scan will make these less of a priority > > naturally in relation to other permanent tables, but with the new > priority, > > we are making these staging tables more of a priority. Users will now > > need to maybe turn off autovacuum on a per-table level to prevent this > > scenario. That is just one example. > > > > What I am also trying to say is should we provide a way, I hate > > to say a GUC, for users to go back to the old behavior? or am I > > overstating the risk here? > > It's probably worth testing out this scenario, but I can't say I'm terrib= ly > worried. Those kinds of tables are already getting chosen by autovacuum > earlier due to reltuples =3D=3D -1, and this patch will just move them to= the > front of the list that autovacuum creates. In any case, I'd really like = to > avoid a GUC or fallback switch here. > > -- > nathan > > > --00000000000019e69d0642576e4b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
HI Nathan

> Tha= t approach would begin aggressively scaling the priority of tables
> = sooner, but I don't know if that's strictly better.=C2=A0 In any ca= se, I'd like
> to avoid making the score calculation too magical.=
In fact, with the introductio= n of the vacuum_max_eager_freeze_failure_rate feature, if a table=E2=80=99s= age still exceeds more than 1.x times the autovacuum_freeze_max_age, it su= ggests that the vacuum freeze process is not functioning properly. Once the= age surpasses vacuum_failsafe_age, wraparound issues are likely to occur s= oon.Taking the average of vacuum_failsafe_age and autovacuum_freeze_max_age= is not a complex approach. Under the default configuration, this average a= lready exceeds four times the autovacuum_freeze_max_age. At that stage, a D= BA should have already intervened to investigate and resolve why the table = age is not decreasing.

Thanks=C2=A0

On = Thu, Oct 30, 2025 at 12:07=E2=80=AFAM Nathan Bossart <nathandbossart@gmail.com> wrote:
=
On Wed, Oct 29, 2025 at 10:24:17AM -0500, Sami Imseih wrot= e:
> I think we do need some documentation about this behavior, which v6 is=
> still missing.

Would you be interested in giving that part a try?

> Another thing I have been contemplating about is the change in priorit= ization
> and the resulting difference in the order in which tables are vacuumed=
> is what it means for workloads in which autovacuum tuning that was
> done with the current assumptions will no longer be beneficial.
>
> Let's imagine staging tables that get created and dropped during > some batch processing window and they see huge data
> ingestion/changes. The current scan will make these less of a priority=
> naturally in relation to other permanent tables, but with the new prio= rity,
> we are making these staging tables more of a priority. Users will now<= br> > need to maybe turn off autovacuum on a per-table level to prevent this=
> scenario. That is just one example.
>
> What I am also trying to say is should we provide a way, I hate
> to say a GUC, for users to go back to the old behavior? or am I
> overstating the risk here?

It's probably worth testing out this scenario, but I can't say I= 9;m terribly
worried.=C2=A0 Those kinds of tables are already getting chosen by autovacu= um
earlier due to reltuples =3D=3D -1, and this patch will just move them to t= he
front of the list that autovacuum creates.=C2=A0 In any case, I'd reall= y like to
avoid a GUC or fallback switch here.

--
nathan


--00000000000019e69d0642576e4b--