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 1vEJYE-009zlY-5M for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Oct 2025 03:42:13 +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 1vEJYD-005eIg-47 for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Oct 2025 03:42:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vEJYC-005eIR-QI for pgsql-hackers@lists.postgresql.org; Thu, 30 Oct 2025 03:42:11 +0000 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vEJYA-004UtK-0j for pgsql-hackers@postgresql.org; Thu, 30 Oct 2025 03:42:10 +0000 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-37a1267c45dso2461251fa.1 for ; Wed, 29 Oct 2025 20:42:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761795729; x=1762400529; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=qAeaVVRd+i42MhSl783u2GtBjwxuYYGqCmYeNOV1vbo=; b=kUiOZ7IHHEQZXHdhxfc6UiB9eybx8SOPWow1mm/aivoDm75vi5UX7tVddhgAvQ0eUR H7B4qMPGAdD5fUpTh99coSChbvp8ry3B/mjWr7BVf6nI3KQHGlnQhLGdVXBDlncuey9V dtY5IgxUD+yg7zVd2ctjofDyMYcxaXT/eBgt8xNEM3wkC8BH9prlCVCFXf15+6jYf7XS MgiyfYibXTT+/Mu9h2bt+/Cznq0tZbBKh9a1bwNFPquogXcq0N+PuZAm6r7ZPnAafyKm kV4Z/dYT+zbdBEWKlUYuPoJuHTAP2pLIWcLI6BNN5735Oy6H0iaQR23k1rb6G32CMsZE fCQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761795729; x=1762400529; h=content-transfer-encoding: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=qAeaVVRd+i42MhSl783u2GtBjwxuYYGqCmYeNOV1vbo=; b=nUDcdeWFlU1ZEOqeWAlyICeB6avPzKQG3bwATx7jajZEUy2K/lOjphMIBEYO5CegaD Sk7fxgZ4DEUlzSudhiKR9B8o+zbPqyMaJ/yxtFHpUkSbO4bPTIl9Yx27oLQDsE2ffBo/ O4O8SfMUZ2sXeTTRz5FTZUKnXXIS8j2SKIfOxac/qmLTQ24OliYVNHoSIBAaQKee3JD5 TX6S3GrANODI54pnujPrd9dDGwaBP2unsG2U1KHEfW6/ArrAHdkvxJT67wjb1uIMXJ6W VZ7lVAmGXe0gBJUHMM3YD0wDw+mz0+aO8CkUIFQZXp8kJta2xSVr/bfhjqJV5T47K7CE WkMg== X-Forwarded-Encrypted: i=1; AJvYcCVT1I9xIx3+E/U2rzQ9MLSrLWazya1j8jJPJkt+nkHNB3Rq/LA8hUXM7IUokfNckN/W7wEzIbgN9r6SV9j8@postgresql.org X-Gm-Message-State: AOJu0YyBO1vdYMC6XlOtFDtxRy+8D+P+8/j4dcmhksedJxhR9GUkMLml HcQmEgO/wi09GQJESW/Mi1sM3T2Aj8YeSPYwqmBjsTZhGBLfgUin8Oe2OseHQEP62gg29ohq4Nw JIMs2iHBGnx1xvHaU3X4vgeVyojjKxDs= X-Gm-Gg: ASbGncvoINbDVcSmU+gQQq9WTUiFcDWcD7WbaXovaXV8Yb+BnSPy9j0doE4+5U4EAqY QD0vCjPfIYHrUNObLdmbkC8rmhG95hxdky9YgebNZMb34/sCcPJSKCQyQmbEd/KLEAPSx4HFyPD el9sq1vF4i7OGfaPD8j3V3Gs4bH9C56hzPXUd0Tyif4kIX9qH4fcC8IuZPujNTZNIew4eG0DcMw vDCa+XjbEc7BQnPGjYCZHLVv3jq2KFsFu32zUKSodnPrHn5GhdhizWaXp/+CEJuJaLYji+lC/K6 zT3cNKwZ/qpio/effD+GsMQxoN60ahbUcJpR8unnkbP2pXQIEQ== X-Google-Smtp-Source: AGHT+IFk4qNNdtKQkxUrYSTWGTL2UKC36+Tnr8ySQ3A35ddxqU5gHNvgPTn4R6ok+4QksHC9dwCCAk6AyhHzwiPwmXc= X-Received: by 2002:ac2:4c4b:0:b0:593:3a3:54c5 with SMTP id 2adb3069b0e04-5941289574dmr1749150e87.8.1761795728404; Wed, 29 Oct 2025 20:42:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: David Rowley Date: Thu, 30 Oct 2025 16:41:56 +1300 X-Gm-Features: AWmQ_bl-i8Tb5FjVqC9XrHvdsglhS0yvk_T-Q6tRW5tn35XEzyj20wDPkAR7Qw8 Message-ID: Subject: Re: another autovacuum scheduling thread To: wenhui qiu Cc: Nathan Bossart , Sami Imseih , Robert Haas , Jeremy Schneider , pgsql-hackers@postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 30 Oct 2025 at 15:58, wenhui qiu wrote: > In fact, with the introduction of the vacuum_max_eager_freeze_failure_rat= e feature, if a table=E2=80=99s age still exceeds more than 1.x times the a= utovacuum_freeze_max_age, it suggests that the vacuum freeze process is not= functioning properly. Once the age surpasses vacuum_failsafe_age, wraparou= nd issues are likely to occur soon.Taking the average of vacuum_failsafe_ag= e and autovacuum_freeze_max_age is not a complex approach. Under the defaul= t configuration, this average already exceeds four times the autovacuum_fre= eze_max_age. At that stage, a DBA should have already intervened to investi= gate and resolve why the table age is not decreasing. I don't think anyone would like to modify PostgreSQL in any way that increases the chances that a table gets as old as vacuum_failsafe_age. Regardless of the order in which tables are vacuumed, if a table gets as old as that then vacuum is configured to run too slowly, or there are not enough workers configured to cope with the given amount of work. I think we need to tackle prioritisation and rate limiting as two separate items. Nathan is proposing to improve the prioritisation in this thread and it seems to me that your concerns are with rate limiting. I've suggested an idea that might help with reducing the cost_delay based on the score of the table in this thread. I'd rather not introduce that as a topic for further discussion here (I imagine Nathan agrees). It's not as if the server is going to consume 1 billion xids in 5 mins. It's at least going to take a day to days or longer for that to happen and if autovacuum has not managed to get on top of the workload in that time, then it's configured to run too slowly and the cost_limit or delay needs to be adjusted. My concern is that there are countless problems with autovacuum and if you try and lump them all into a single thread to fix them all at once, we'll get nowhere. Autovacuum was added to core in 8.1, 20 years ago and I don't believe we've done anything to change the ratelimiting aside from reducing the default cost_delay since then. It'd be good to fix that at some point, just not here, please. FWIW, I agree with Nathan about keeping the score calculation non-magical. The score should be simple and easy to document. We can introduce complexity to it as and when it's needed and when the supporting evidence arrives, rather than from people waving their hands. David