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 1v6h66-008HO0-BM for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Oct 2025 03:13:42 +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 1v6h64-00F9rM-4n for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Oct 2025 03:13:41 +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 1v6h63-00F9rE-RU for pgsql-hackers@lists.postgresql.org; Thu, 09 Oct 2025 03:13:40 +0000 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v6h61-000mFa-3C for pgsql-hackers@postgresql.org; Thu, 09 Oct 2025 03:13:39 +0000 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-3761e5287c9so3209681fa.2 for ; Wed, 08 Oct 2025 20:13:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759979616; x=1760584416; 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=aPEdnLEEKJMl/2kHKl5Fj50GxAnJ+ZbsAcCd+x65rWs=; b=DJUCq+9TwmnShJDbOJ8TTtqvVeCoqtPzeHhoAWjUryeGdv9+GvK+TqVB7AGF8Mov7b rcNsRaoZSucMh2DJ4FHmD4BDjyV7ZlLoKgoQgLyIHnAOFLMRq61TsCXIVBMf+6Mf+WJA dArwi7BdBCNI2ANX0EokIM1e+O7b9+w9KiCAFJagPdckgP4fWrT4/XfeoSC5N6hbrkSk oeVHXIKVpPqM5hm00CU7KVOFgzhZglk8I3U6J4GtVNd680vhLK9arxmYcCLJO1sajYKH a653ij7qKgko7tm9TRccD/8y4ppzyjd4ffP+Ky68sujI91Wo7zFA8DRvHSXlj9Vc2jwc 82ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759979616; x=1760584416; 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=aPEdnLEEKJMl/2kHKl5Fj50GxAnJ+ZbsAcCd+x65rWs=; b=KvHvkzjX5Ab6ocAcNx2Tiq1Oitx5gJQY4fU6e3/5e4eu9lTR2XrO+UscAdmswUEC46 42ChduJavLTQmwzhHGBa3WALdibY+IK30ZbVO++tkoVJfel7kzs142y7ueX0MudG3EI4 +KfVaLlHph3pptLpgDS8krcKhOlkH03H/EdUMTA4QnfyxXSlmHCuVEyTVWva9q5RKgkv Y16G/0tRonk/x01//pQzqxf/8G+aMpgW6c/fNvR5SLDVB0tQzQgeLRXbXyQMFQQIfjta i6/Lo9Bi4m1KWWgfjAmd45Y9iyP3dOTDjf6TGYQpD940cWamZsqU5M32ErJZYbw9QqnP J4Dw== X-Forwarded-Encrypted: i=1; AJvYcCW+G7gq37MUwoXceDQ9KhfqfP+a69LQz3JdQpAs/lIU/zE4xUMyhQLr0XpcM4ZhwoSaMK+FpfAezgccYUl/@postgresql.org X-Gm-Message-State: AOJu0YzX0O9JYUft+0/z3fmp2xEAZkZtIcbLhXD4geBqRueBb1aLIdev AB4gk9f9oHksimiRzcLovDydODVW3nQizdcakunxs+GhXATBCdBajKo6lZYaRII15a/XnGOTIyr 7csijkM2pdQiHZ9XiuU3oduHyEfDyGdI= X-Gm-Gg: ASbGnctdfjF2qMD2hd0SEzGFuepVm1PJGrIG1VcSCh7SM/M1KLaJiC8jmPtlm9/VEnV Qoz0LRlybFzsoiampA4SNJDOenzAcsqg7FG2YNrUqkgMX8jKeb/HD389HpwZTBSXt4xMNRhXNGI XG2n39U8oEwK3UVyttvNgBVIpiMUcveiIgQzFLKC6dRQkI8pxswyFpX526UGtIMTALTc5+z2azr TvSkb+pChRl8FJbGaKfCV2GWrNSGImX38T13aRcQi8E5i9Wp0j2MOcoxqb4bOihu7gQ/uckE77q vPpnbWYsH/YMcwQPZRvlHKarzQDPHPd/ X-Google-Smtp-Source: AGHT+IGgBaCt5voxUjFASSc9igXnobHgJxeXoxb8QlCaHWnaFhBUVfOYGU+XS+7edCUL2wsmGM5mtkKu7Y6cuHRdaX4= X-Received: by 2002:a05:651c:1ca:b0:36d:54b3:9f81 with SMTP id 38308e7fff4ca-37609e92335mr16413831fa.41.1759979615540; Wed, 08 Oct 2025 20:13:35 -0700 (PDT) MIME-Version: 1.0 References: <20251008164057.6bceb9ed@ardentperf.com> <20251008172727.3befd129@ardentperf.com> <20251008182520.6e05a8b8@ardentperf.com> <20251008184740.328d45de@ardentperf.com> In-Reply-To: <20251008184740.328d45de@ardentperf.com> From: David Rowley Date: Thu, 9 Oct 2025 16:13:23 +1300 X-Gm-Features: AS18NWDIi_VhezzW77QtBOUcyJ7rzdWRjPZvFzlZ574EYQOTws-RLQVsBLyF8kM Message-ID: Subject: Re: another autovacuum scheduling thread To: Jeremy Schneider Cc: Sami Imseih , Nathan Bossart , 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 Thu, 9 Oct 2025 at 14:47, Jeremy Schneider wrote: > > On Wed, 8 Oct 2025 18:25:20 -0700 > Jeremy Schneider wrote: > > If users are tuning this thing then I feel like we've already lost the > > battle :) > > I replied too quickly. Re-reading your email, I think your proposing a > different algorithm, taking tuple counts into account. No tunables. Is > there a fully fleshed out version of the proposed alternative algorithm > somewhere? (one of the older threads?) I guess this is why its so hard > to get anything committed in this area... It's along the lines of the "1a)" from [1]. I don't think that post does a great job of explaining it. I think the best way to understand it is if you look at relation_needs_vacanalyze() and see how it calculates boolean values for boolean output params. So, instead of calculating just a boolean value it instead calculates a float4 where < 1.0 means don't do the operation and anything >= 1.0 means do the operation. For example, let's say a table has 600 dead rows and the scale factor and threshold settings mean that autovacuum will trigger at 200 (3 times more dead tuples than the trigger point). That would result in the value of 3.0 (600 / 200). The priority for relfrozenxid portion is basically age(relfrozenxid) / autovacuum_freeze_max_age (plus need to account for mxid by doing the same for that and taking the maximum of each value). For each of those component "scores", the priority for autovacuum would be the maximum of each of those. Effectively, it's a method of aligning the different units of measure, transactions or tuples into a single value which is calculated based on the very same values that we use today to trigger autovacuums. David [1] https://postgr.es/m/CAApHDvo8DWyt4CWhF=NPeRstz_78SteEuuNDfYO7cjp=7YTK4g@mail.gmail.com