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.96) (envelope-from ) id 1w0842-001dox-2X for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Mar 2026 01:08:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w0841-006zUV-0Z for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Mar 2026 01:08: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.96) (envelope-from ) id 1w0840-006zUK-2S for pgsql-hackers@lists.postgresql.org; Wed, 11 Mar 2026 01:08:41 +0000 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w083z-00000001XDL-1T3E for pgsql-hackers@postgresql.org; Wed, 11 Mar 2026 01:08:40 +0000 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-b972641eb96so91056366b.2 for ; Tue, 10 Mar 2026 18:08:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773191318; cv=none; d=google.com; s=arc-20240605; b=R/KesMt4XIIli0gIzBHRPJGLe827xN9ZXPuGI5jE2uHyoIU2Mc8LdJY5d5+Lj4DUEM 8edn45lJgOUEN7MhN7HB5Md2QI+GknchcfbT5hI9RC/ZqaA1++YFQG3Z274wo3YktHxI neCsQw6Ndi1dAoRLwqjARp+Z3zb/r7RpvwuSlcigJnixKgqhhVF4s2rL0bzSCu6Lsl31 kVOd40tAn+euLq+Ta3Tdu8mEDtsd5OrpJaSyBAeVcrPWYOdwTYcpbZso8XqIqruVO+L9 Y14ET6otJ9tfcrYt82j1DXaiVWy2EAhxQy+SDjqdGKpuxMxkHATizupJHRIQd/pyNViK BMEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=JSYMBsdbaZ2VHem13zH3HusXhBiRgwCHzRvbfh2OgiI=; fh=kQ/e3xLYe9kFjgWwyzuX3X+9zz/EcZX4oAFuUTjVCzc=; b=YV2hojoPe+scdvqs5oSRhLje6EeX5Dm+ZEaIk44Q7hwxT5Ha/7ZfQJFAXlhyiay0rd pUt3v3zFGnc4IW/EIy0bQi4tIwwy1lZBmITHvLLLG0vBHo6XnWDEiotHM4kZzdkUc/e8 rvthGKZNXP4qr7o1EIGgfN6bsVM/ezpeRtDVsxOQ9RDAr10jHSFTAati/DFgalNg9Olr +6pF5Dc050ExaajvkQvlsvGJM3VLpb8Rs99SLetafj2hDg3BfDyNDet6bO+JrmbM+1XG pLxfp2Hb3BrCYU0FbISheReOIFMrLaMtq/c3megSnxQyeqn5bE0FZ42VEscIx3v7GiXT lT1g==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773191318; x=1773796118; 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=JSYMBsdbaZ2VHem13zH3HusXhBiRgwCHzRvbfh2OgiI=; b=LCUDcc61sVC+uYdNKkE4BRbnRfL0vDNF+7ts1CzI+Jk3V79O06y/EBhPeitTum4dzc JoxlpLHTiMpeKL5oWN5Q9tG3uu/ebCyXy8ww0DYorFbjLV0lIhF78tewWe9jpjOFGu8P btmTjescv4NzOWTlswOpN1f23TKIUedo4UDGZgqQemXmcPUZ5Za31TBO6zZU4V96a4bz EHDA4tZeNP89tN96abAE8ur+zlcwwL6uTlbZDui70EZ5p6XKC1i4HD+rhlRb9LIZGj31 kalQEyjRNKLhHzay56XVr7Jwu0WUyhCxbyqOhDJQAesuhc+mP5VnPdkM6eF+v7hKiyZr DjlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773191318; x=1773796118; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JSYMBsdbaZ2VHem13zH3HusXhBiRgwCHzRvbfh2OgiI=; b=qUR1dqtNtpfbaM8IbhnmCZljCsSxRGzxBB701n5woELDNzJ2wfR/WCPgmgsVxzj7aM 7sinvXQ1TSNQxUvwxQPBB6YdD4OTz4VeSTp/x7qKVvk62K1PHv3AufvxkbSvWkUOmH0c BLv/hAT6so6AMq7d7NYCYrZ59ZyMR8H8rMvICx4xQSltCNJyYfPyprxeV+dgLHLSSwOb ppMe3thHBps0/wKD2EgnDcliGJxu5aV8KLRv3k6KdQFF4mAzmbTPUG4hXD391VxoyF3y j/zZaksATZblABGDgj/tEnBhHC+czmJ6bgjKQJlJCtKeWs5Km7kiCn16ErWnIxIel5zu rADg== X-Forwarded-Encrypted: i=1; AJvYcCVXou+vXiU/tXjtJwmSAu8eszfMG33RX5/3v2iPjnf+FDM7du5Tb1r2QwnBU9MEA4hUkt73SXfT4JO7UsZZ@postgresql.org X-Gm-Message-State: AOJu0Yw11lPlU/m5vw914Gx8PON8W9j0w8AMNtdpHBoa8De60rGtRpZ8 Iv8uUh+Sf6+wwhiJt2KFHCzBrYyil2kXsk8wQEX/6m6PJnSK4BPcXj31P6KCqNWxKF2b/SNFjVE Q0CNEK9nFiNsKPt0h9CpuXshlByWaRgI= X-Gm-Gg: ATEYQzyTYbWxpZ76DOAdmYaT0xPnYRTH8hVedsQd2cr+h1mbQsezW3/Qk7ROl88cxrg xEQ0q3sbvbjy2toWFVPwM8iC/zOwDbjmSEvL0fElI1Pc7DWW4sX7LslLkPtjt5sd9aWuorf/ABl 7vAMof5PSFuDpIBjLhehk+LKRIb8Q5Zw1rFdD1Yyw0z1hIxFn/SqSBLnU29LIosV6oVK8KDcCPP oHtKXIrqM8c+4bK4Q4PsWrl/NWmlUE3cH8c6E8qFWSsPaU5m2qpwYr2C74pjydiO4HmtmdSeLUD FZ9v1g== X-Received: by 2002:a17:906:9fc7:b0:b8a:f61a:edf2 with SMTP id a640c23a62f3a-b972e5fbe66mr28238266b.50.1773191317756; Tue, 10 Mar 2026 18:08:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Sami Imseih Date: Tue, 10 Mar 2026 20:08:26 -0500 X-Gm-Features: AaiRm50RHuBeTt-E0n6bTsXk3XTGqMKqx59_Vu34t1ADWOMSTGZI5eY-_QoB1cw Message-ID: Subject: Re: another autovacuum scheduling thread To: Nathan Bossart Cc: Robert Haas , David Rowley , Robert Treat , Jeremy Schneider , 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 > Just a few things: > > 1/ > + Oid xid_age; > + Oid mxid_age; > > Is using Oid here intentional? I'm curious why not use uint32 for clarity? > > 2/ > The new GUC docs says "...component of the score...", but without > introducing the concept of the prioritization score. > I think we should expand a bit more on this topic to help a user > understand and tune these more effectively. Attached is my > proposal for the docs. I tried to keep it informative without > being too verbose, and avoided making specific recommendations. My apologies. I found something else that may need addressing. + if (xid_age >= effective_xid_failsafe_age) + xid_score = pow(xid_score, Max(1.0, (double) xid_age / 100000000)); + if (mxid_age >= effective_mxid_failsafe_age) + mxid_score = pow(mxid_score, Max(1.0, (double) mxid_age / 100000000)); + The current scaling calculation for force_vacuum could lead to exorbitantly high scores. Using DEBUG3 and consume_xids_until(2000000000), notice how the score goes from 7.93 to 661828682916018.125 once past failsafe age. 36), anl: 0 (threshold 97929), score: 7.930 2026-03-10 19:41:11.979 CDT [74007] DEBUG: foo: vac: 0 (threshold 195809), ins: 0 (threshold 176836), anl: 0 (threshold 97929), score: 7.930 2026-03-10 19:41:32.062 CDT [74038] DEBUG: foo: vac: 0 (threshold 195809), ins: 0 (threshold 176836), anl: 0 (threshold 97929), score: 661828682916018.125 2026-03-10 19:41:32.063 CDT [74038] DEBUG: foo: vac: 0 (threshold 195809), ins: 0 (threshold 176836), anl: 0 (threshold 97929), score: 661828682916018.125 2026-03-10 19:41:51.961 CDT [74066] DEBUG: foo: vac: 0 (threshold 195809), ins: 0 (threshold 176836), anl: 0 (threshold 97929), score: 26761249940789168.000 Do you think it will be better to just to add the age to the score? if (xid_age >= effective_xid_failsafe_age) xid_score += (double) xid_age; if (mxid_age >= effective_mxid_failsafe_age) mxid_score += (double) mxid_age For most cases, this should be high enough to to make the score high enough to sort to the top, as mentioned in the comments: + * As in vacuum_xid_failsafe_check(), the effective failsafe age is no + * less than 105% the value of the respective *_freeze_max_age + * parameter. Note that per-table settings could result in a low + * score even if the table surpasses the failsafe settings. However, + * this is a strange enough corner case that we don't bother trying to + * handle it. + */ -- Sami Imseih Amazon Web Services (AWS)