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 1vBIeA-00Ekel-2y for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Oct 2025 20:07:53 +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 1vBIe8-00BYeP-MG for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Oct 2025 20:07:51 +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 1vBIe8-00BYeH-Av for pgsql-hackers@lists.postgresql.org; Tue, 21 Oct 2025 20:07:51 +0000 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vBIe5-0032Ou-26 for pgsql-hackers@postgresql.org; Tue, 21 Oct 2025 20:07:50 +0000 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-36453927ffaso53526991fa.2 for ; Tue, 21 Oct 2025 13:07:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761077266; x=1761682066; 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=K8a3ZXnsCJEA4P95l4Z15Z3V+uqj36iIFzxxHaBr6Gs=; b=XtdiPOyl+yNphVNFFJ3/ZGNqiSqzntJ3h2Yf00qec0qNJik4mGFDd2O+YVxONloKna KsbR8vox+tYmvywt5YA8FinTP1CpcODoi4JE+8crmz6+xjuhGUdU1nl20XS1ImzERaS+ nC1Kz3j4uxS6tOKoCU00/JWD5FOCFZYyceAY39C3X0+XMa05wS0PWogpoaYgCOgvHHih 0rwFSUT4CqqBbqfHFMvnB2Q+NsR90YI5b8Pcwx+wgDkfwYrMNmJP6FrXv432TvUbjpJB 3EMVTwb4cN9mqwkOvtaQKpNnp1bOmoYIy5/Owy0XQZLbiTnDNDZyhrTb8QMJvXf6hQG5 mpug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761077266; x=1761682066; 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=K8a3ZXnsCJEA4P95l4Z15Z3V+uqj36iIFzxxHaBr6Gs=; b=QGIZ5yGSEJwZvxcZaLuuEwzBYsfjYeuoMlJKX6U5cy6iBvbc2UcHjR/C+FHOnt6/Gp 7ozrFF8Z2kY5OX8wScynu6dOIbtvBn4Pivk36RH5B4f10jmjEHXMtqy3e1/Rfp7ppDYM XJoh4gghO//vJr2Y1XT4iOF0lxcPGb86FFm38Cl98kKfPj0VIXtSVIRo6wSdsSxfZBsH 5zHTNBO8ZnPBq1dDvi3NDTqa9pqjGbXWbDV6DiPSDyG+z0874kfeTt9fKSwriZsfbS3e 47sEv8aQvdudNwnZ+KOkKOCV0Rfnvb19/4ob/+oymdn/UC500/8/KXXYTDShYAmbIJgA 911w== X-Forwarded-Encrypted: i=1; AJvYcCU5h/CzEmsYRkp9iIZkaZFXPtDfKvkNua+mKymkyXpBmozBxZIFZyGsFIaz5PV5jhhcq7K2Xmyhj1pJ2Wxn@postgresql.org X-Gm-Message-State: AOJu0YzgdiooHzQWrIJnAH8Mp/T0FgfMVnoM5pgBPj1Zlm8uNLUAlgtM dxrXRax9AG2NCRsJT+szHJfthBjf1vi574Gz/87h5TeS5rE1fUgJlVn0YEVbWWxI7D4883OJmFW /lHGEePr5LdjQluLO77Z4M7bTeA3vK1Q= X-Gm-Gg: ASbGncsQireh9JkFWFCVdBWl7ymY3KtEHT/fsajQMKQdV26SiVWHH0rN0Wrlt0o11Ac OQkRGIJ0e7sN8M9H+P1fIrlcaPxeXbhj+0MSba82rSxfNRDcbPqbm2sD1x4oBP7o7CwfrY8zIG9 I/6Acou3GI6gDZLDPB8jX3i+v+pjw601pQHFKhPb9c0GEoab9xZJWthYFAvn4H+8OCsjssXaonV qGtVEa051lWwwNPalHVcqgFS06/3/1EnQno+KM+DEiKW6kzeiyCJftVEAcaWmufo7f6LXY5nBj7 RG4fikudp4awv2GA+WqF4DZqCSZv2NaVl5UFDRCHGJLH0+I+W5U= X-Google-Smtp-Source: AGHT+IGXrq9oZcgdnw9aA04NuzK0j4Hc+7ohIihtyl5h0QYKrvqCp/N+UezULpXM5QfCkvs+/mcc7qYkz7P/yS+EsW0= X-Received: by 2002:a2e:a90d:0:b0:377:c58c:1f15 with SMTP id 38308e7fff4ca-377c58c1f85mr22492851fa.18.1761077265851; Tue, 21 Oct 2025 13:07:45 -0700 (PDT) MIME-Version: 1.0 References: <20251008172727.3befd129@ardentperf.com> <20251008182520.6e05a8b8@ardentperf.com> <20251008184740.328d45de@ardentperf.com> In-Reply-To: From: David Rowley Date: Wed, 22 Oct 2025 09:07:33 +1300 X-Gm-Features: AS18NWD87OK-r4pd1hqdsVHmq-Pu2utOc-74m3p9o_v-JcLlBOwsiVxmYsydZ4s Message-ID: Subject: Re: another autovacuum scheduling thread To: Nathan Bossart Cc: Robert Haas , Jeremy Schneider , Sami Imseih , pgsql-hackers@postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 22 Oct 2025 at 03:38, Nathan Bossart wrote: > I did something similar to this in v3, although I used the *_freeze_max_age > parameters as the point to start scaling aggressively, and I simply raised > the score to the power of 10. > > I've yet to do any real testing with this stuff. I've not tested it or compiled it, but the patch looks good. I did think that the freeze vacuum isn't that big a deal if it's just over the *freeze_max_age and thought it should become aggressive very quickly at the failsafe age, but that leaves a much smaller window of time to do the freezing if autovacuum has been busy with other higher priority tables. Your scaling is much more gentle and comes out (with standard settings) with a score of 1 billion for a table at the failsafe age, and about 1 million at half the failsafe age. That seems reasonable as it's hard to imagine a table having a 1 billion bloat score. However, just thinking of non-standard setting... I do wonder if it'll be aggressive enough if someone did something like raise the *freeze_max_age to 1 billion (it's certainly common that people raise this). With a 1.6 billion vacuum_failsafe_age, a table at freeze_max_age only scores in at 110. I guess there's no reason we couldn't keep your calc and then scale the score further once over vacuum_failsafe_age to ensure those are the highest priority. There is a danger that if a table scores too low when age(relfrozenxid) > vacuum_failsafe_age that autovacuum dawdles along handling bloated tables while oblivious to the nearing armageddon. Is it worth writing a comment explaining the philosophy behind the scoring system to make it easier for people to understand that it aims to standardise the priority of vacuums and unify the various trigger thresholds into a single number to determine which tables are most important to vacuum and/or analyze first? Thanks for working on this. David