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 1vBe2U-0024CU-GO for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Oct 2025 18:58:25 +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 1vBe2T-000paF-GH for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Oct 2025 18:58:24 +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 1vBe2T-000pa3-6y for pgsql-hackers@lists.postgresql.org; Wed, 22 Oct 2025 18:58:24 +0000 Received: from mail-il1-x12d.google.com ([2607:f8b0:4864:20::12d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vBe2Q-003fA5-01 for pgsql-hackers@postgresql.org; Wed, 22 Oct 2025 18:58:23 +0000 Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-430b621ec08so185505ab.0 for ; Wed, 22 Oct 2025 11:58:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761159500; x=1761764300; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=otfEEmNVrFgwjIblDVRLQyKJcCkck8IKBY7YqYEequU=; b=H0PrEn0u1y0T3t6YTKNEjhY7cCsjmEmRrZlIJmvdJLS3tq8QHobCt1k6qP3xSpzgpV Adhe4+A3+lCaoZJ+P9phU+vO2CStgEHccpDaA3m6c9QmcRytxSNzZ+p4z6hITyWhr7Lv AtIbtIoG4qf1Q07Rp7zkiOP8Kq8keZ1U03VBEQRAAsolDRhpBeRCDCZfFHmBn4J8amRl YaT7jeoBI1s8w0pzdEDuGCwUkTZZ73qa4SokRIMZCh7C7s2RbTQBk/HZZuRzljcsWe7R 2YKP/qRcgUi+e7iutsO38+z7nI8MTJnOtsF5Ko7mNHojiEmQgCHlXm/2fKnSsMcQRCyj yOhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761159500; x=1761764300; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=otfEEmNVrFgwjIblDVRLQyKJcCkck8IKBY7YqYEequU=; b=N/P6Qo6y5ttCfA7mnXjCLvuGamRrbUzkdfAP1OKD2FizlaAIbIVfJGIUni80QZDU3M sCIkJyg/OMBibl+ADbsjMDBXhheeuhG4mcjsgEMUQhkUt0kbhlxyzpYzaptqL42g74Pt aKkIoqdUWOo/qd/Vt1LjtT60t5eq9RVU1034VU5yAzkS9GuCjEsvDH1EHVpi3LEnaOzr trM508yR5pT79RtYSP3M4mzXscBGdbZ1smU9ln27shIhMDrnvMOVM+MuTKh3g7xgPVkj UecMZRZM7qSnvzuGOQjujNiOsPRp+EF5hq33CkrLfijQFrHF8irFSp6sv+6qM8hXMHRM WB/w== X-Forwarded-Encrypted: i=1; AJvYcCXU2f8SIr76NYIuJ/s2ByRJrZKqx0UadzMen0KW7CKwLJJPEN9mJNVJ0zSp3ahXmcQE6J/AO+kUDKhPtxQU@postgresql.org X-Gm-Message-State: AOJu0YzlQNNDqsFe9lYws06ZkSkJ/cVQF7L71nZovm5N7X72hKkxzhpK 5axd3dwtL4pqn1ix/+IWXm60z47zzjmQMoQSUj+F75d760RY+HWu2WB4 X-Gm-Gg: ASbGncvENALVSfhhUEDIhcyiQ2kR9o44/Kyr0hUkhzvYHkhoVMR1xU538M9Qq4IDhft Zr409Z8+pyevivWz+q5X+bdt3h0pPPwR0pcFC/eL/p5vGl9hBeuNLpVscIUTVG5xtswbvYtCviv pQYsxIe29uULdDfNO281HJJdBlznQrKVS60epJjeNtXVjG3qo8BbAsvaenHhScrWlLOvr3jSH3o JOXR6DpoRWxGNyDvVXb1uC3XqbdIJZSQpsXifxByz35bxNWMv4xGlMRLx+6xuwTJldUC9cJB6TC 2yamVngBcPlFrrvHMYCXfq4GGaCFTB+SQnOrkxCDxx/1SdcIrWisu1hX1LV0J7WIY7VbNnPCvC/ KosgizmcI1zyCbxMZp7s8CE2e+oAFYMR77Y8y80wQLpWbVKOTw+8q2AAsi0xc9xtfPkJww/Rqvo fjSLyoOwIsATOoezNXGTShWCAIcGaCayGfH1ASPBu3eJbp8pOOx7r3ML1kwwQ3/755lg== X-Google-Smtp-Source: AGHT+IF97CB0jsyKl5p1Zm/X86aQCQFvYiCbmSnQxYja6qo4tyzBbwdfwhVQZi+Tu2ijXMukYzgtsQ== X-Received: by 2002:a05:6e02:2506:b0:430:ad76:a5d3 with SMTP id e9e14a558f8ab-430c522d94dmr336254385ab.11.1761159500099; Wed, 22 Oct 2025 11:58:20 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-5a8a9768ba3sm5315261173.45.2025.10.22.11.58.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Oct 2025 11:58:19 -0700 (PDT) Date: Wed, 22 Oct 2025 13:58:17 -0500 From: Nathan Bossart To: David Rowley Cc: Robert Haas , Jeremy Schneider , Sami Imseih , pgsql-hackers@postgresql.org Subject: Re: another autovacuum scheduling thread Message-ID: References: <20251008182520.6e05a8b8@ardentperf.com> <20251008184740.328d45de@ardentperf.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Oct 22, 2025 at 01:40:11PM -0500, Nathan Bossart wrote: > On Wed, Oct 22, 2025 at 09:07:33AM +1300, David Rowley wrote: >> 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. > > That's a good point. I wonder if we should try to make the wraparound > score independent of the *_freeze_max_age parameters (once the table age > surpasses said parameters). Else, different settings will greatly impact > how aggressively tables are prioritized the closer they are to wraparound. > Even if autovacuum_freeze_max_age is set to 200M, it's not critically > important for autovacuum to pick up tables right away as soon as their age > reaches 200M. But if the parameter is set to 2B, we _do_ want autovacuum > to prioritize tables right away once their age reaches 2B. I'm imagining something a bit like the following: select xidage "age(relfrozenxid)", power(1.001, xidage::float8 / (select min_val from pg_settings where name = 'autovacuum_freeze_max_age')::float8) xid_age_score from generate_series(0,2_000_000_000,100_000_000) xidage; age(relfrozenxid) | xid_age_score -------------------+-------------------- 0 | 1 100000000 | 2.7169239322355936 200000000 | 7.38167565355452 300000000 | 20.055451243143093 400000000 | 54.48913545427955 500000000 | 148.0428361625591 600000000 | 402.22112456608977 700000000 | 1092.804199384323 800000000 | 2969.065882554825 900000000 | 8066.726152697397 1000000000 | 21916.681339054314 1100000000 | 59545.956045257895 1200000000 | 161781.8330472099 1300000000 | 439548.9340069078 1400000000 | 1194221.0181920114 1500000000 | 3244607.664704634 1600000000 | 8815352.21495106 1700000000 | 23950641.403886583 1800000000 | 65072070.82261215 1900000000 | 176795866.53808445 2000000000 | 480340920.9176516 (21 rows) -- nathan