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 1vDUYu-00AKZ3-5b for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Oct 2025 21:15:31 +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 1vDUYs-009TCa-9M for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Oct 2025 21:15:29 +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 1vDUYr-009TCR-Vl for pgsql-hackers@lists.postgresql.org; Mon, 27 Oct 2025 21:15:29 +0000 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vDUYp-0045rr-13 for pgsql-hackers@postgresql.org; Mon, 27 Oct 2025 21:15:28 +0000 Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-92b92e4b078so227153739f.0 for ; Mon, 27 Oct 2025 14:15:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761599726; x=1762204526; 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=YrcrVPj2sAmfZuRGHbRcnesD5Y74Jk7CrOYUtSCoHqU=; b=YlrNJuAmpAa8cnj409omqDqORQWZ4Gicf+5Dc54EBgy8D6X1MNP19PCTctm5W4JLhp kh07yt/DWaqk+FbbDOhkxD5v9psM7hMfBzWpnXvJyi12EWVpEmGDww1gKVQBjnFoDwdy kHNnDCfreAgG6lTRdzAychd84Kzgs1ISmojfC+0ACFo4nksEMw2oLvFxSylQAcHJniWj 36Mm/Zx9TdBseLlGxgeN53UaVn9RnHELTina8UVW4WSa1f0wFgfb77l4v6uKz1m/59Ii mWMGjWgtyFazey7s0IYItSJIk06t0BwS85ZpsLvt8KKR3Gqc3mV4y5MOCBKhPP2L1YCy msgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761599726; x=1762204526; 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=YrcrVPj2sAmfZuRGHbRcnesD5Y74Jk7CrOYUtSCoHqU=; b=QjU4XlhqKJYSpTHGHDg8R0qFgoqThQl6TcDW5/lTQRWmMxNSbwLaMfEmFotI0zsYo6 fg4A8WM6g34AFGQerA7G8mMovEKbo8VU2eptYNvgodxnr5BIrtfzWcJjabUP4rH4I4GX y3m0ffyE/jasXxcqZ9i43c6PWZcSpuV8cKwICAOA63mFWzLJ2q8if8xy7yUeXtCho+w1 eJs21ywSpvnQcJF5b7kRwZwLWP4mxwGcoiz6vjmo0LrDtyvvouGznAQfvsy6tMMdS9mD 0h9PaJua14ZfiZgYmf1rn/PO/YUkHkQrCydO3C64z6Zl8U0gOFeRQVA8gQ48XT7RaxHA dO0A== X-Forwarded-Encrypted: i=1; AJvYcCUlnWEm3OwzTa9dUGNMYv6KUX4siXGjQ04L+z08SPJyvP9gJ81izYnLcPg8VeJkJ246jg1OHTNIUIDDz5jp@postgresql.org X-Gm-Message-State: AOJu0Yz4NCjEqKLE4MCnDfIJo4Z5TXSPWTNFpmUJWQ17Q7M4JMhkufWG B3SKaWw0vRwRdDJBYowXgkrdhBzeREknZkyg5F1/syMRK9VmWVbOYdQq X-Gm-Gg: ASbGncsFkWU3Bt7ufjKmOi9RMxk5u4vjKxMAlGK/MfZfRDNA/gaDZsns6WFeCJNZoal YVlIe3VDFwbsjt+9xgxJCrhxDRjMCYIJ7wwCVx1d+vRRH2SF39iikrZ8db3yXzXwhR5ew4ETjpA 7hRwlfaheyYtD2cxy0VUOzLNY88R9cweIdpxGu0hjT3WLDecWZHH3JMYcFJeUZF+WvHcMQje7yO RQAgiNjHKhLcIR88YPdQWE0hTESNF65R7tYEzyb4zCyfvLMF3Bo3Q/tvE1OC6aLBvfSFbQCDQ1h 14+1IlxERsITRwhCYs8uiMZA1v/9P+f22p94BiKTlXKVEDoYWUWA+aE/uBAFQZL2YU+gfe7CGVq 5eGeA38woc0Ftkq/qG6mlv2kCj2heEteyLOJGA+ZAJl2+frciHK1p6It5IAORpg7BpBERt53uC8 7ejY7Ttz0WK4mge/TguI6eVFOQRSQN/4Z3U7RPgc3bbTpqrNJUtB5Ok598nmo8whTugaFwYqE= X-Google-Smtp-Source: AGHT+IFepEA4R+en/WoRp1hV+zr+lO0EuTlnLwKEUh4nUA04+raybm31G/IKTp+yXoybJZ3QTSghDg== X-Received: by 2002:a05:6e02:178a:b0:42e:7589:6290 with SMTP id e9e14a558f8ab-4320f6ccc11mr24439625ab.12.1761599725756; Mon, 27 Oct 2025 14:15:25 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-431f6714f2esm34559995ab.0.2025.10.27.14.15.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Oct 2025 14:15:25 -0700 (PDT) Date: Mon, 27 Oct 2025 16:15:23 -0500 From: Nathan Bossart To: Sami Imseih Cc: David Rowley , Robert Haas , Jeremy Schneider , pgsql-hackers@postgresql.org Subject: Re: another autovacuum scheduling thread Message-ID: References: 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 Mon, Oct 27, 2025 at 12:47:15PM -0500, Sami Imseih wrote: > 1/ Should we add documentation explaining this prioritization behavior in [0]? > > I wrote a sql that returns the tables and scores, which I found was > useful when I was testing this out, so having the actually rules spelled out > in docs will actually be super useful. Can you elaborate on how it would be useful? I'd be open to adding a short note that autovacuum attempts to prioritize the tables in a smart way, but I'm not sure I see the value of documenting every detail. I also don't want to add too much friction to future changes to the prioritization logic. > If we don't want to go that much in depth, at minimum the docs should say: > > "Autovacuum prioritizes tables based on how far they exceed their thresholds > or if they are approaching wraparound limits." so a DBA can understand > this behavior. Yeah, I would probably choose to keep it relatively vague like this. > * The score is calculated as the maximum of the ratios of each of the table's > * relevant values to its threshold. For example, if the number of inserted > * tuples is 100, and the insert threshold for the table is 80, the insert > * score is 1.25. > > Should we consider clamping down on the score when > reltuples = -1, otherwise the scores for such tables ( new tables > with a large amount of ingested data ) will be over-inflated? Perhaps, > if reltuples = -1 ( # of reltuples not known ), then give a score of .5, > so we are not over-prioritizing but not pushing down to the bottom? I'm not sure it's worth expending too much energy to deal with this. In the worst case, the table will be given an arbitrarily high priority the first time it is vacuumed, but AFAICT that's it. But that's already the case, as the thresholds will be artificially low before the first VACUUM/ANALYZE. -- nathan