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 1v7I5E-000ROh-M2 for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Oct 2025 18:43:16 +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 1v7I5A-00DltN-Vc for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Oct 2025 18:43:13 +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 1v7I5A-00DltF-Kk for pgsql-hackers@lists.postgresql.org; Fri, 10 Oct 2025 18:43:13 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v7I59-001Sn0-0Z for pgsql-hackers@postgresql.org; Fri, 10 Oct 2025 18:43:13 +0000 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-b3e44f22f15so344460566b.2 for ; Fri, 10 Oct 2025 11:43:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760121789; x=1760726589; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=MetsXCFaunmxzxbTg4RgoZkLl6W/L+pM0GD0edAEJe8=; b=DYj+gW2JN5WvNS5NlnAKbOllSIaMwbSK+pDE5SS4Tu3qfJKbRLVkClu2F+FQEk872t Rs+mp0fQD9culZSndqLr/2a7HI24kxpleyPX57gfClCMW5u37WF7DIhOxpv5flfHQHGM vEmareBVqKpYq+KniQd+LELTVGK8db1/rdKmC7nSynykncvqG57i5cNix+b3nZihcMOs DzwAR8UOuANcum0lSMRtInQXy/7P7D6RViGpP0VbwQrokLfu+0APrTb32fcX3KLLF0HT FAiq0EWlYvCijeFuyZ7e8y1jatDspTXWkDH4XXPCRB3SwbJyTlet0FbqtpDEoIP4dWZu dlxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760121789; x=1760726589; h=content-transfer-encoding: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=MetsXCFaunmxzxbTg4RgoZkLl6W/L+pM0GD0edAEJe8=; b=eQyHxx5MTWl/JA+2NKpzBHefuUB22Sh+V+bhst+cwntjuw+4IzzqRNCKj0S/AliFrk UvAwt34d2PsJ4fVy7+HuJJOFsg4akBgIP+mZaPzCCX3kMoX8PQJRgwu5Cxw7hoWErzrw F1NeXxoSQnOdZ5pBMc6L+XeNmjH4yS4iOtMuwcF0wde96Upj8FhOf32dlGO/AMyZxcCW M1uXj7SKVpHN0Cwy7QTW4VEZnoi1gtSmXqby0gUiu7vgNcoUooXNFcwpm4pFIUpkT0z0 AhDMOBedVoO4eYVFCXywq59U9lB2o/o3zJBg6Y+KaKe0Ihx4zsB1NZhzlmmR1SL5i3s+ oLCw== X-Forwarded-Encrypted: i=1; AJvYcCUL6toJwBZOSV1TRhw2VhPY4wVfQm5SyPMxaJXL1WhBBAmA8Mcds16Iq0g3lLFqCxHCNgJNA+Jfw0EjkCjI@postgresql.org X-Gm-Message-State: AOJu0YzXKJresHjNH0DLnq47uJ900xqZdnPtjT4ZV8ajdxkwaq3tbFHt rjQ5fyePw2ChXtnZR2elpsyC8skRjwjyX4RgKy6wSTGvnGYH9iuauR0I49+vTJ/RxrnqO7enJu2 Q1xHPDR0d3lCNh4KgVqsz67GRuxfI2VuF2A== X-Gm-Gg: ASbGncuqsUr5GN4JeAEeHnXYfpu2oRs10esc8+mG/2cYeLDboR4kZgPVDlRTxULZvmH kqbykUFKucJ54jsmzMKTpnlUlx7WEVs5lS4OON89HId3V4kM0B+yfanOqKs1OSzdRiy2xKmC029 mihvtv2E8mqchPO2SMIlLL0d+xN45aqVyVYzpvsrh+AGyG8gM9gXxFrwuzGz0Qq76v9dHFj6ZsC zxueldQaVqedAjhdeMVk5o05QY= X-Google-Smtp-Source: AGHT+IHiYbskuF0mDfZ55l/1N1X8MkdJl4vgeCmgJWfa7EmHWBS0DhAlXBfZ5pKo3Y31lzqgI9ieeGm5RULEEEH4lS0= X-Received: by 2002:a17:906:c14c:b0:b49:96e4:183c with SMTP id a640c23a62f3a-b50a9a6cdebmr1226804866b.9.1760121789085; Fri, 10 Oct 2025 11:43:09 -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: From: Robert Haas Date: Fri, 10 Oct 2025 14:42:57 -0400 X-Gm-Features: AS18NWCq-czjTyv9f2qwB4k6_akUbM8xLMoC1sS0KJfezYKxIMtS4y_s9Zl-HbY Message-ID: Subject: Re: another autovacuum scheduling thread To: Nathan Bossart Cc: David Rowley , Jeremy Schneider , Sami Imseih , pgsql-hackers@postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Oct 10, 2025 at 1:31=E2=80=AFPM Nathan Bossart wrote: > Here's a prototype of a "score" approach. Two notes: > > * I've given special priority to anti-wraparound vacuums. I think this i= s > important to avoid focusing too much on bloat when wraparound is imminent= . > In any case, we need a separate wraparound score in case autovacuum is > disabled. > > * I didn't include the analyze threshold in the score because it doesn't > apply to TOAST tables, and therefore would artificially lower their > prioritiy. Perhaps there is another way to deal with this. > > This is very much just a prototype of the basic idea. As-is, I think it'= ll > favor processing tables with lots of bloat unless we're in an > anti-wraparound scenario. Maybe that's okay. I'm not sure how scientifi= c > we want to be about all of this, but I do intend to try some long-running > tests. I think this is a reasonable starting point, although I'm surprised that you chose to combine the sub-scores using + rather than Max. I think it will take a lot of experimentation to figure out whether this particular algorithm (or any other) works well in practice. My intuition (for whatever that is worth to you, which may not be much) is that what will anger users is cases when we ignore a horrible problem to deal with a routine problem. Figuring out how to design the scoring system to avoid such outcomes is the hard part of this problem, IMHO. For this particular algorithm, the main hazards that spring to mind for me are: - The wraparound score can't be more than about 10, but the bloat score could be arbitrarily large, especially for tables with few tuples, so there may be lots of cases in which the wraparound score has no impact on the behavior. - The patch attempts to guard against this by disregarding the non-wraparound portion of the score once the wraparound portion reaches 1.0, but that results in an abrupt behavior shift at that point. Suddenly we go from mostly ignoring the wraparound score to entirely ignoring the bloat score. This might result in the system abruptly ignoring tables that are bloating extremely rapidly in favor of trying to catch up in a wraparound situation that is not yet terribly urgent. When I've thought about this problem -- and I can't claim to have thought about it very hard -- it's seemed to me that we need to (1) somehow normalize everything to somewhat similar units and (2) make sure that severe wraparound danger always wins over every other consideration, but mild wraparound danger can lose to severe bloat. --=20 Robert Haas EDB: http://www.enterprisedb.com