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 1vF2JK-006QrB-I9 for pgsql-hackers@arkaria.postgresql.org; Sat, 01 Nov 2025 03:29:49 +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 1vF2JH-00303H-SE for pgsql-hackers@arkaria.postgresql.org; Sat, 01 Nov 2025 03:29:46 +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 1vF2JH-003038-G4 for pgsql-hackers@lists.postgresql.org; Sat, 01 Nov 2025 03:29:46 +0000 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vF2JE-005M8X-0X for pgsql-hackers@postgresql.org; Sat, 01 Nov 2025 03:29:46 +0000 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-5930f751531so2943784e87.3 for ; Fri, 31 Oct 2025 20:29:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761967783; x=1762572583; 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=ZiGAHXYgr7ZfBswKxDyJyNAe8ESJG0Qzs1QA4wVUWMg=; b=YOq/HauxcMRJwnMlnR8TXmCa6tBKL9MLJzNX37X3+BbTIhQTYJ2CHAK6yVUNaynsq9 pnpDhRzx5oL8Js8sXjdv6LDe7/lMvJJUht8xaZet897AbjYELcZIFUPFphkfYspp9005 iic2KlavriRLv04gx+22gP87M5uiglKifP8hug3mZ4EG1ZrF0O5bYOagi24J8QAkFWiU qnN9D2qIkA+LD8GQxOwG25FYIoznwVLPq8wyQa7vklDzTia9UmQ6Gc2HfcP9MHtUmkKn xJVgTjrPxYe1X8+GkNLwRFkxUAI0dwoXZkjr+l3R2Ynn/Hap90sPMEhc2uHMahoNmU02 Rabw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761967783; x=1762572583; h=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=ZiGAHXYgr7ZfBswKxDyJyNAe8ESJG0Qzs1QA4wVUWMg=; b=Cl608iZGaXBKPJpGCqu+KgX9wOixLs/W72j7YprPNIN+oqoa2LdDKxbuL+JH52iA1R Fn9wuS+RKYncXkex2T6dz2dwS7EC9fGURDPyAuXeebeIEqElyJ/hnmYm+nw/k+qQ8jCm +sb1IOqbyak9tMKjdnH8+arOyMXXSSAXhyfibzeQnuYSUhZ15ubtpCz2niqgmmfsM0+f /YYZ2BxuwukUgpScdyQE9YQ/vFBt4ucce4yZDx+K/23Wbl0UZU2Iy/PzkSnBb/EpPSQn h6bm4HgWGxLOG8bx8vXJEPev7lAZPXcWExZTMm/IlCnAAuxjVQxhk/htStvkhaNDoujw hNtA== X-Forwarded-Encrypted: i=1; AJvYcCWBgw3iQfoVeMYA5G93TBnJm1pAZQ9Xm9bqYGH/Bg4SvEtyU+ryzfizQjPg+Y/It6dH7P/3y4mfo1jzh8w7@postgresql.org X-Gm-Message-State: AOJu0YyisxArP7pb7/Ao9CppiqcrFaN+cQVaxBICG3WSaNBwwV8TF+9m 94/4HDY6/gFgkAM1z0hHTdHfzGf99XMctBDqtB0ZPgwBOOVopGwQYySKTYav3XXLwVx+ub/m2Wi 1w++81oava/Gms0IkcDIzfnopevegDP4= X-Gm-Gg: ASbGncsb/nPxR5Var5uJQcTRj32RjF86o87y1Ys5z+YZDB2VHD5nFSRUpp7CBrYpObO 48WG8VSn29ObtRdS/J+cGOWtyC03AKMYFwUXbgLoGHV52RpH9LeMo93KMN0q4QsbFd543tlQ5xS SES2TVAgFU9dG2dNhr3nfiK5i3U/Mahp28NhW8y7OPo48sdtGxwPHnDiYv4nEhXk/uIpoafcp5w qnwUDCcE5GuSymz4Oaaos/1gFBW4PCWynLFdPjpVNXqjSQhaXD2rz4o7+wtVLVEWyAblCg17k4N GaWQc8G1PySBpfgaGDSatpGSJxuWVX96GvTVeeMCLg6xT1CEnz8= X-Google-Smtp-Source: AGHT+IG1OKO06GgddOP1WBcUAeSDSLE3fQIuR1Nqc1nzn0JnZD4niXp4Phw1Bh307QAjz6EJNyAjBNAd2ekIVfwTnB0= X-Received: by 2002:a05:6512:3d1f:b0:594:1c7a:99ec with SMTP id 2adb3069b0e04-5941d558337mr1776610e87.26.1761967782539; Fri, 31 Oct 2025 20:29:42 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: David Rowley Date: Sat, 1 Nov 2025 16:29:30 +1300 X-Gm-Features: AWmQ_bnaw9wb9j2NoioV4nQ9TIDnENpe8DBSM_rojc5_YNzI66umQ5HTLvQ7-Do Message-ID: Subject: Re: another autovacuum scheduling thread To: Nathan Bossart Cc: Sami Imseih , Robert Haas , 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 On Sat, 1 Nov 2025 at 14:50, David Rowley wrote: > If we logged the score, we could do the "unpatched" test with the > patched code, just with commenting out the > list_sort(tables_to_process, TableToProcessComparator); It'd then be > interesting to zero the log_auto*_min_duration settings and review the > order differences and how high the scores got. Would the average score > be higher or lower with patched version? I'd guess lower since the > higher scoring tables would tend to get vacuumed later with the > unpatched version and their score would be even higher by the time > autovacuum got to them. I think if the average score has gone down at > the point that the vacuum starts, then that's a very good thing. Maybe > we'd need to write a patch to recalculate the "tables_to_process" List > after a table is vacuumed and autovacuum_naptime has elapsed for us to > see this, else the priorities might have become too outdated. I'd > expect that to be even more true when vacuum_cost_limit is configured > too low. I'm not yet sure how meaningful it is, but I tried adding the following to recheck_relation_needs_vacanalyze(): elog(LOG, "Performing autovacuum of table \"%s\" with score = %f", get_rel_name(relid), score); then after grepping the logs and loading the data into a table and performing: select case patched when true then 'v7' else 'master' end as patched,case when left(tab, 11) = 'table_batch' then 'table_batch_*' when left(tab,6) = 'table_' then 'table_*' else 'other' end, avg(score) as avg_Score,count(*) as count from autovac where score>0 and score<2000 group by rollup(1,2) order by 2,1; with vacuum_cost_limit = 5000, I got: patched | case | avg_score | count ---------+---------------+--------------------+------- master | other | 2.004997014705882 | 68 v7 | other | 1.9668087323943668 | 71 master | table_* | 1.196698981375357 | 1396 v7 | table_* | 1.2134741693430646 | 1370 master | table_batch_* | 2.1887380086206902 | 116 v7 | table_batch_* | 1.8882025693430664 | 137 master | | 1.3043197367088595 | 1580 v7 | | 1.3059485323193893 | 1578 | | 1.3051336187460454 | 3158 It would still be good to do the rate limiting as there's more work being done in the patched version. Seems to be about 1.1% more rows in batch_tables and 0.48% more updates in the numbered_tables in the patched version. David