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 1vBDVi-00Cu3w-Nf for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Oct 2025 14:38:50 +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 1vBDVh-009j8e-LJ for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Oct 2025 14:38:48 +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 1vBDVh-009j80-78 for pgsql-hackers@lists.postgresql.org; Tue, 21 Oct 2025 14:38:48 +0000 Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vBDVe-002zmU-0K for pgsql-hackers@postgresql.org; Tue, 21 Oct 2025 14:38:47 +0000 Received: by mail-il1-x130.google.com with SMTP id e9e14a558f8ab-430d098121cso16266515ab.0 for ; Tue, 21 Oct 2025 07:38:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761057525; x=1761662325; 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=E7UxTg+uO6G9i/bhLq0hJmInpg1aFedMjiB9Q88VBWg=; b=Rgz/I+yxN17onRYd9ttt59Xhh6wVSGdTbzU/AN9yzfgDOzfEDZsSXfaOpOzNv3g/BQ IDnJ8kRiDCckEXa6wsudndzP4P1bRXT4m6HR4fu4QnskpJV+QiQXCArDv5kHCZd3xVc9 ZdDbuYYI+vwoeHwzGM9aqngSqEFrFS0Bb/ZZcSAxswog0gxRIO3T9P4BpMbTxn/mAgeU EMn8h6okxtos7lT+oJFvpqEEKmkPpxqsOTXKuWJaS6goPWqmO2Xdi+qaqJBcaHQ4BT8I mT57NCggs3nOznzyrXiYQGuHkvMPhOmoaDqgsHCxEUPh5q4k3jhqBopDr3LUInJd+ERi SERQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761057525; x=1761662325; 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=E7UxTg+uO6G9i/bhLq0hJmInpg1aFedMjiB9Q88VBWg=; b=JUC++fgYa4YKcgRDrTedCL4GdogTA4zOUwu+UOAotj3/z7461YjCShynDZyZFiWYlC bUfdTEwYhHOTW8I7HeqyQ3oTZ9TBZbs9otYzBMwcerk/jxrPKJ8TqLMYyVGpGXdq3o/v qM0+JhBuJW4vdiu6L8TfUbMrDBuli2NcwNt5SJdrIq5xuOphiZ/w0CHzvokfn9h29lMF xnu/CbYA529zK8UiCkHELKURhzGTPSYvgrPMyTsvY/w7ychVa7iG62IQCD2tCnz/wCiO WiSRNNaH48aVtqR/UYE9Dv1e4yzcdXiTsAihdQ/Y6OBEF5v2geoT7439jFO0Yr6iFrTz 0MPg== X-Forwarded-Encrypted: i=1; AJvYcCW/LVcTxj9PCRH0ySdFXHwuj3ulVwXQ1nL4OXWDGJLVOp4W0oee4fuIEQIoDb6mOjJBlHUU7JhZt2Qte9wn@postgresql.org X-Gm-Message-State: AOJu0Yxjzhah03F5p6NKEEm21vTOfLah7yQu+xRXNLYvPZCHZEATDPcH Oh1o/mxQm92sogfPbSxZq/YWPxltp2nh9ZTIK8YOkaknVb4ZWc6WBX0i X-Gm-Gg: ASbGncszNO7yAo+gc+0woae7XVd/0wER0vAgTdlEu8tK9tckj19f/DYKw7g/GX6yleR xYe6IJJKQKThEhe/TruXyv6b7c+Oe0ghoYt/5QRcHuhIr8NzE9Zxl916DrBx3n9eAE9YhOzzjwb HlHAt1zkm4tbyueCBZK0c5I7QvL5PiQ/pJHY8RokRrX9LvOQw7wMjPQ6FHV+bTiAiyv6nJvAZ8c vhEp1CAUUpjjtycFjulOzNoZWWWpCdqm8+oj2kO1gQQMBzNTfP3OkCREBcW5UBumLGd6rw4PJso 3fJULVTEmKc7ff/yaI7wMPIlUtowKKEDFZIo07qd6zm4OJe3VA8TxQbIU56uzr5LVODh5RIGkd1 HE8U6uu1nZguFlHwH132Eto1cna3HCJm9B4+KgIpVCIfHuRgTj+8ADNZ66cgv4O5v4Fes5TwW7X UxAFY24nwwoQ8lZ5HERKzwX7EbX31MqcAqjwwi1J6bgyNEG9/QSfqlPkTQR2DxspA+ElABYcCSM gBG X-Google-Smtp-Source: AGHT+IEq3x3soCpw7xxWc1Vx9PoDpmFuGjg6S7/r7Ex0MbR7Zc0lM2rshvMsb6jZ/ttQKNDSuNuBYw== X-Received: by 2002:a05:6e02:2511:b0:430:adfa:e4f6 with SMTP id e9e14a558f8ab-430c52b5b2cmr227368805ab.20.1761057524596; Tue, 21 Oct 2025 07:38:44 -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-5a8a95fb8b5sm4106257173.8.2025.10.21.07.38.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Oct 2025 07:38:43 -0700 (PDT) Date: Tue, 21 Oct 2025 09:38:41 -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: <20251008172727.3befd129@ardentperf.com> <20251008182520.6e05a8b8@ardentperf.com> <20251008184740.328d45de@ardentperf.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="qlOG+R55HnQikzN+" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --qlOG+R55HnQikzN+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Oct 12, 2025 at 07:27:10PM +1300, David Rowley wrote: > On Sat, 11 Oct 2025 at 07:43, Robert Haas wrote: >> I think this is a reasonable starting point, although I'm surprised >> that you chose to combine the sub-scores using + rather than Max. > > Adding up the component scores doesn't make sense to me either. That > means you could have 0.5 for inserted tuples, 0.5 for dead tuples and, > say 0.1 for analyze threshold, which all add up to 1.1, but neither > component score is high enough for auto-vacuum to have to do anything > yet. With Max(), we'd clearly see that there's nothing to do since the > overall score isn't >= 1.0. In v3, I switched to Max(). > Maybe the score calculation could change when the relevant age() goes > above vacuum_failsafe_age / vacuum_multixact_failsafe_age and start > scaling it very aggressively beyond that. There's plenty to debate, > but at a first cut, maybe something like the following (coded in SQL > for ease of result viewing): > > select xidage as "age(relfrozenxid)",case xidage::float8 < > current_setting('vacuum_failsafe_age')::float8 when true then xidage / > current_setting('autovacuum_freeze_max_age')::float8 else power(xidage > / current_setting('autovacuum_freeze_max_age')::float8,xidage::float8 > / 100_000_000) end xid_age_score from > generate_series(0,2_000_000_000,100_000_000) xidage; > > which gives 1e+20 for age of 2 billion. It would take quite an > unreasonable amount of bloat to score higher than that. > > I guess someone might argue that we should start taking it more > seriously before the table's relfrozenxid age gets to > vacuum_failsafe_age. Maybe that's true. I just don't know what. In any > case, if a table's age gets that old, then something's probably not > configured very well and needs attention. I did think maybe we could > keep the addressing of auto-vacuum being configured to run too slowly > as a separate thread. 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. -- nathan --qlOG+R55HnQikzN+ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v3-0001-autovacuum-scheduling-improvements.patch