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.96) (envelope-from ) id 1w5YaQ-003N2W-2Q for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Mar 2026 00:28:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w5YaP-0006ug-0s for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Mar 2026 00:28:33 +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.96) (envelope-from ) id 1w5YaO-0006uY-35 for pgsql-hackers@lists.postgresql.org; Thu, 26 Mar 2026 00:28:33 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w5YaM-00000001B7Z-2iyc for pgsql-hackers@postgresql.org; Thu, 26 Mar 2026 00:28:33 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-483487335c2so4607695e9.2 for ; Wed, 25 Mar 2026 17:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774484908; cv=none; d=google.com; s=arc-20240605; b=Ugc5Qy5qsZrZar2qQ5EniSvQ846KWcwFLzQobjYSoKyB/Tv5Cy+C8QJvufmCaEllB8 yTUx4/yd7GTYQcNAMO2ic60s2tI0mgNJ7A4Tt+D6x+W6MRcYmZa0kG53ktX63LRV0FBZ 9q1r4fYjUzJ945SoFshd1nB8kx9mpPCu2ZMHebPBN9J3Iw3v93i5oFFSeIjwNW2pKDhz kPfe5qw5zX1aoYZpV044M4pjU5Fyr0+/fC79kZWbcFh48u42VKwV1rS3Niazqux7Ap3c hfKOmh6zibIpTmqGRpystjJkG5ykqD75yjeUe7+wRvpahlBLJzpBBAI8yOdo/LQR7AvY SHkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=dMrLh5bNWh9U3WLIxFls4Rolv4B5Nt8uJRm28MVjnJg=; fh=rksaN/MGqdJWTog0QRCNqsNC2wQdR5nhPMZBrDitBdA=; b=FPM5kIqRV3k3UBvQNjzYe2l1wgbQ/CKrld//D+CWHPAbWkfB7x7j/01SAny2FHWjfK ovqwl+B1vvAFzSuByCE53h1kJ06crzFBN5m17UIIUVbOjyNLUoAbLPwz92fsV3cFDpWP ehZd2Grtw2wasU8KzjAfy+ZjzlnYXZq4CAXJq6E+PBE0WEkSvRHcQcaHYcmwTXirlHCj 0tjz4EluSzs8xhFxRdtKcgjVswJFvU6Op5QFn9AQ2a6aglTe+UFHiPa/g3j6mOIR0t3Y 1B+YzpJsxV/0M41yNldOOvohuPKzL0AvmgJxqGZHNbm49MqebRzJIIsz8250pXsiMklN KVrA==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774484908; x=1775089708; 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=dMrLh5bNWh9U3WLIxFls4Rolv4B5Nt8uJRm28MVjnJg=; b=JbOCBG4dUpL8wa6V33kVYkXl9kIor+WxT7w9CtMTqyWi5Cnql0/iV+ftmbdSxkiOHc MmA/ZvZ+k53ebpyn/BbVwfO9y3sSueDyEj0QdseDTMP56qdwfRCd5IQbjDQBz8xSLSEn APEjbLyB2HOmb3JCZ/xK2/y2/arL7E9Fcrll7XJ2VfBqEGA9Gt1bPSpg4DVETghaB7eb y4OFRHX4+vuA4I+b9WUi6GUZmS/cfXjE9i5ZjmNZjjRduPBMsdFeTtkrTB/HbNUF0XKz Zck5rKLBHG8DFy91BvA7aRDG/g9KOpd85AQWm7Foi9D2C++LiiRy8K5NbEHy4hvxijxJ /Lwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774484908; x=1775089708; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dMrLh5bNWh9U3WLIxFls4Rolv4B5Nt8uJRm28MVjnJg=; b=csrkkrhWoRsqrDTGeYYmXFlwWOlKQHu/wX198w/Qc/Zkg9NSci+xR+49cqNGdTfoWm nvrGdjFhlKlzgTJwoMadaxOBOdh3sWnRzQnzWkmoKcFptu+pRXdAQWEogJVoNOnJpUlV 8pB1p7Ifc4U6tokmI9Gos/P2cpV9+2FL8UzTO8xM29wAR/lbtVp4jmKxAMqBHC9rj41w K9gdfQt9GYqTCc5Oi/jnQ/oMGwoS3UPKe1JxtkLiz7jH6gRJQv2WUSohDZslheKny6Ca SBIk1Eh/tUKvrkfQBz2JxsQFqjuI12/bDxZXA1UwrZY14iHaKdaoq7/zlvJcpRM8k7F5 Rt7g== X-Forwarded-Encrypted: i=1; AJvYcCUXwnXbTfIYDB8xotGsEgWxDUWFofct8t58kxoXJtzdpXms63iN1Ji8yuNBnnpJHIfL+pTTGnNg2KQg+Zcx@postgresql.org X-Gm-Message-State: AOJu0YwoDFS+HbblrKyAHD1hYZi9BShtAlU+f9n97f6xdI/PKkAjW9SC TtZWQH2oe3Yt0SeC2VIMNYi8jlMtcr/gWqB2qoyLStm65iHRMff6P2qMwHFrLRyTwks/ZNZIGiv b1JLwoxhoGv33d088D7PAuIqztRAzWh8= X-Gm-Gg: ATEYQzw/hkCHRRLB/S0dS6i5fzvz3DcsCexjvVMx6tvNwjTTWJkDYortG5aGSEvEoLh jCOYmoOpdtljPDZocFjp8TITYHSHN0h3zhcEfKSeJWq0/ZjmbOvXgnr2epiMpSyePsyAs9UZKTE hbtM7uoT9Emg1/vtCpm5otMNyff0XCUCIJcYdje4G4oJnv+dxWnEitY7t0uzz2WQVC2hJFudN3H fIdSTtEJBSJTzb3B3a6TcpQa4IXXkrvy0NPmT1xv7yiE9jssTnaA+yWWP0KRuxwjnXIoVmH0o9E s81XxhGG2L8I9PT7T+sYDZCXj5GkTDMy4C5rQXvOiFjJSR6eRFwc/8on1+3p68CkYbI7SWQn X-Received: by 2002:a05:6000:4381:b0:43b:3c27:238a with SMTP id ffacd0b85a97d-43b88999451mr7681139f8f.8.1774484907920; Wed, 25 Mar 2026 17:28:27 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: David Rowley Date: Thu, 26 Mar 2026 13:28:16 +1300 X-Gm-Features: AQROBzBpufM2XjK8-laPfVpdWZLDnF49hR3p_KnAwkDfA7yQoXMV4AXxwjHjCWA Message-ID: Subject: Re: another autovacuum scheduling thread To: Nathan Bossart Cc: Bharath Rupireddy , Jim Nasby , Sami Imseih , Greg Burd , Robert Haas , Robert Treat , Jeremy Schneider , pgsql-hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 26 Mar 2026 at 11:10, Nathan Bossart wrote: > > Here is what I have staged for commit. I'll give this at least one more > close read-through beforehand, but I'm hoping to commit it Thursday or > Friday. Thanks everybody for the thoughtful discussion. A review: 1. I don't think the following is exactly true: + . Furthermore, + this component increases greatly once the age surpasses + . The final value Should it mention dividing by the autovacuum_freeze_score_weight? 2. Is it worth expanding the following paragraph with some examples? For example, raising the priority of analyze, someone might want to set autovacuum_analyze_score_weight to 2.0, effectively doubling the analyze scores. + + To revert to the prioritization strategy used before + PostgreSQL 19 (i.e., the order the tables are + listed in the pg_class system catalog), set all of the + aforementioned "weight" parameters to 0.0. + 3. We talked about this a bit, but after reading the below comment and looking at sort_template.h, I wonder if we might be putting too much faith into the current qsort implementation. The presorted check should pass when all the scores are 0.0. There's also the code that runs before that for when n < 7 which shouldn't do any swapping. I'm wondering if that comment might be putting a little too much faith into that remaining true in the future. You're also calling the same thing out in #2, so maybe we better take some safer measures to ensure it remains true instead of relying on the current qsort code not changing. + * between 0.0 and 10.0 (inclusive). Setting all of these to 0.0 restores + * pre-v19 prioritization behavior: 4. I think we tend to favour not breaking ERROR strings up like this: - elog(DEBUG3, "%s: vac: %.0f (threshold %.0f), ins: %.0f (threshold %.0f), anl: %.0f (threshold %.0f)", + elog(DEBUG3, + "%s: " + "vac: %.0f (thresh %.0f, score %.2f), " + "ins: %.0f (thresh %.0f, score %.2f), " + "anl: %.0f (thresh %.0f, score %.2f), " + "xid score: %.2f, mxid score: %.2f", It reduces grepability of error messages. I guess you could argue that this has so many format specifiers that it's not that greppable anyway... I sometimes do guess those to grep for things. 5. Maybe worth specifying the range in a comment in the following: +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -733,6 +733,11 @@ #autovacuum_multixact_freeze_max_age = 400000000 # maximum multixact age # before forced vacuum # (change requires restart) +#autovacuum_freeze_score_weight = 1.0 +#autovacuum_multixact_freeze_score_weight = 1.0 +#autovacuum_vacuum_score_weight = 1.0 +#autovacuum_vacuum_insert_score_weight = 1.0 +#autovacuum_analyze_score_weight = 1.0 David