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 1v6fPM-007x50-Ma for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Oct 2025 01:25:28 +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 1v6fPK-00EDFq-6n for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Oct 2025 01:25:27 +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 1v6fPJ-00EDFd-Sp for pgsql-hackers@lists.postgresql.org; Thu, 09 Oct 2025 01:25:26 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v6fPI-0018Z5-2r for pgsql-hackers@postgresql.org; Thu, 09 Oct 2025 01:25:26 +0000 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-2681660d604so5068405ad.0 for ; Wed, 08 Oct 2025 18:25:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ardentperf-com.20230601.gappssmtp.com; s=20230601; t=1759973122; x=1760577922; darn=postgresql.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=iTZhm4xulnkdxx/Sr0fY2hOD6Lyyw3zGqycHZrZquxk=; b=hmHo4NECIugF0BxfJkEIf9s2jHLCzQXFofHIPd0I54kXU1tYYaKsLzHnXPNk/GaoM5 bTyUbIC9opdFNs89q60SvjecimunbNZI8lDU4SlgQYSKgrfwjjQpADufVbAizi08rl1b DvtqH0QDlxbd4siWnz+8pQ/hqwoZWjVF6FbrDH4cPIlRMI7Habz4mRKZirTnZyMO6YH4 b+63lEWZ3w7uMQpYQKAt9QDCxYXk3mImzp0j67VA3RCyHQx/Q+/EYnlamXSkOyFpUr49 sbOaX2Wvmc1+6S9F72U5jsyL2bHMMCnMUr3aRtMR9/hzzzUlpEOJ7VluQaUHNswX8/Py 30iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759973122; x=1760577922; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iTZhm4xulnkdxx/Sr0fY2hOD6Lyyw3zGqycHZrZquxk=; b=Fkk+5LyA7Jxz7eSeXVQp/yRQMVn+ogpKpvKt93Gx3DXpwEFBV59ZTMb9vXJYImNkUr 63UE6heq/szm0TjBfbP0dRhSFqg9pacrb/hqPtWedqKhndgC82f62K7Apuu5HLlMw8XJ JcNjb05LhW7obWgs3m99esRB+Hd7EzfY3qD6O1meOovtL4DcoyCNyUB5srKdUtYM6stU iq+pWzjTiNHchcDLu/lQnocJwl7PU4mOSjZGJ5A1JsRAoynitB8ty3NlAmENgz9UhNMn h+azwpKEFJmpY/Krddd+MG+xTlBOQDxYTfWysscx5MbwZsEBTJkD2iu5WT+1gkofqu1z V55w== X-Forwarded-Encrypted: i=1; AJvYcCWZ0sUwA4MRExWvM/gYqYbdbBpp1bZtxb+bde5sMqudstM7mshlK13nCH+liaXVNAVg/4wP+bakYGAhnAhL@postgresql.org X-Gm-Message-State: AOJu0YyYJ9xVBDy3UkhREXFVFj0CabZAhDs4WFIgQMr1XRGB8GYFAFWr 26hOrACCYvUWMFy/BFgB8hlgncD3BKfky216b0oNFpJTROp3j5qwNHQBOdRT2VitkA== X-Gm-Gg: ASbGnct16Jw4GVfVX5POwFd6IOjKq6HD9ScvHI2CRWTGNl5basa6lPSIYyZH/ROVlUt l/0qhM0uh/FqIRXw86OJ+O2+Sp23CQvhuxQ6B2ibsdObJGzs8V2ekOTOyDre2x8Z9zIA7urg/9t rKDYyZtIRAq0G25rK7USW+0F4BoJaL2T9fEH2IEMTLDB9XxdWkwUUjhOfO/ujvvbQt+Z0ssSiHX 68VdNTkgUGz2xgGVY+AHG3fka7YY944F+ZUI6p36Tjc/94Lrd3Rf0aYbqciRT5AVHFwPyo8GpZr OEYm7tCINujH7iFRW5o2O2F0fGRS8zbH9mlBI30daly6Qj/hrnCNidLB+Pi9jPCqYfjV5erbU9T hBt3c+IYZLX+NVF/UTorCI1V9Aa8GawvJLO8RUNmrvSX0FdSpPCWPGWftvB9OYyt9iGL0s90okL gHVwYI0Y5mhCk= X-Google-Smtp-Source: AGHT+IGumAmJyD99b2tMUC512OeYKxn3abdWJiDmqp42Y3bQROrNoo+7yTCtxdJQATgraGnmw/7cTQ== X-Received: by 2002:a17:902:ef09:b0:275:7ee4:83bc with SMTP id d9443c01a7336-2902721354fmr72909845ad.2.1759973122451; Wed, 08 Oct 2025 18:25:22 -0700 (PDT) Received: from ardentperf.com (97-113-159-222.tukw.qwest.net. [97.113.159.222]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b63039f795fsm10382503a12.1.2025.10.08.18.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Oct 2025 18:25:21 -0700 (PDT) Date: Wed, 8 Oct 2025 18:25:20 -0700 From: Jeremy Schneider To: David Rowley Cc: Sami Imseih , Nathan Bossart , pgsql-hackers@postgresql.org Subject: Re: another autovacuum scheduling thread Message-ID: <20251008182520.6e05a8b8@ardentperf.com> In-Reply-To: References: <20251008164057.6bceb9ed@ardentperf.com> <20251008172727.3befd129@ardentperf.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 9 Oct 2025 14:03:34 +1300 David Rowley wrote: > I thought if we're to have a priority queue that it would be hard to > argue against sorting by how far over the given auto-vacuum threshold > that the table is. If you assume that a table that just meets the > dead rows required to trigger autovacuum based on the > autovacuum_vacuum_scale_factor setting gets a priority of 1.0, but > another table that has n_mod_since_analyze twice over the > autovacuum_analyze_scale_factor gets priority 2.0. Effectively, > prioritise by the percentage over the given threshold the table is. > That way users could still tune things when they weren't happy with > the priority given to a table by adjusting the corresponding > reloption. If users are tuning this thing then I feel like we've already lost the battle :) On a healthy system, autovac runs continually and hits tables at regular intervals based on their steady state change rates. We have existing knobs (for better or worse) that people can use to tell PG to hit certain tables more frequently, to get rid of sleeps/delays, etc. With our fleet of PG databases here, my current approach is geared toward setting log_autovacuum_min_duration to some conservative value fleet-wide, then monitoring based on the logs for any cases where it runs longer than a defined threshold. I'm able to catch problems sooner this way, versus monitoring on xid age alone. Whenever there are problems with autovacuum, the actual issue is never going to be resolved by what order autovacuum processes tables. I don't think we should encourage any tunables here... to me it seems like putting focus entirely in the wrong place. -Jeremy