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 1vMsSa-004WJq-0S for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Nov 2025 18:35:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vMsSX-00CGxG-1H for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Nov 2025 18:35:45 +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 1vMsSX-00CGx2-0F for pgsql-hackers@lists.postgresql.org; Sat, 22 Nov 2025 18:35:45 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vMsSU-000vn5-30 for pgsql-hackers@postgresql.org; Sat, 22 Nov 2025 18:35:44 +0000 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-640c6577120so5313999a12.1 for ; Sat, 22 Nov 2025 10:35:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763836540; x=1764441340; 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=b1Ul6rvm86+iKNTBqcP+5Q/orLgRY6q2vrYFFEQYHj8=; b=LuSe2sU9izaghMbKOEknjAQoyB3RYi1D+HDTpd3EBQLMjzL6AE+BbWfIqOWuTa+P7F /ZV0fr2ELN97cvR85ihP7Oq1u69M2mO9TkrrKUjlwPGYr2o/1yFCHOpMRsw/leD1Piah owzyJg1h7L+mwHyj+94d3RAeRYud6cWnTjE/Ox1mnt5YNxp2gPN8SJdg9FC3Hy+4n1r3 AUQ1Zg2GWzbOYOGAto8p52t8bAQ/CtuqPCJWZnViJgq7sUF/IS2Shl+P6dWxcYK48GUn q0ysXqxo4HySucmqRL6Jk8ZyImUhRp+9lCHxl6v3Qgw53tYsOJwrnuSu/kAfl5jBvs8g KYDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763836540; x=1764441340; h=content-transfer-encoding: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=b1Ul6rvm86+iKNTBqcP+5Q/orLgRY6q2vrYFFEQYHj8=; b=miq12ONDllIrVrdjhhX2jQ2hZHQwqQXhX5ZLzaj/COWqFCn6ufpJX6lmTWCWlmtN07 CO4Zu8lmuJtt9vlTuxEWlidOVV5H+JkRb12arvyTsfIhtWyNqlbmahVQJ5z0EFvplRkU lZWZ76fV0cQZIAUPSxNe5/Xy4PgI7PakV1emgotpN2cHth/b0PKfK83D/Nb24awjYZgQ 2VBXRTlA3stZJXj3WEP31U8J7Ht5kEZXGD3YUkkcHT8M99PEjkP+0GQI19qCbUA57T+h BUBlFqDBZxlzwpatY57DZb+AQlIMc9kPGwQfFiJWRBQB/DFHPR7IaSxhQgLgQQ+D9MNa oqnA== X-Forwarded-Encrypted: i=1; AJvYcCV0cDhLZrfcyR6l2eEMF667VxTIr8G4KMx3IxdZ/CEEM2aq97HYbP2eYRzYVk2TUc1lnt/hSaEqYI3gx3ww@postgresql.org X-Gm-Message-State: AOJu0Yy2heF5p1pMOAva2++OwVyp34Y6C9fcpsNAU0GjEx0Fho8ySe+D /1K/wigz1x8UbZkoORK1C24mUi6NXZRBlNsn2WHeIcNDp+nq3FmitWhHNPhw0fDMQkjUmOR443V jMACLrvvA7RlliUrOlLT/GgoywHNtv2o= X-Gm-Gg: ASbGncvvO1Fk1W9KSP/UXSRL4loenARoWG2kwsy3l8oWxjnvINwYsc32N8YCVYoT+my N6LlUms8xgfyf8ngw+DCiUruClq/D6AZSz2R+oSMv6EFah+pDokMTe0oHrhb+kZXVcqRGk/evhK 4OWiy7ISvrKErD6uzPrUfCWECCtAdqQf64UOl8HFz9kG8l0zUumWlHKjv929U4r8XWS4laToORd 5M0Q0mOI06iLn42RB2ulf9sEOLXYod9BptVhtwZRmFN/wekFv9TEnwezeE7ckEpJ1wnVVjxx+bV vHcabNKBNIYdE2sRyCa3ZJLI8Mo= X-Google-Smtp-Source: AGHT+IHVbEnb6wsNRwrJ7QKIT9n3AE6/EYmmth+qvwiEi/Qyln91fmvYpOMPHSXcgOaByuzP6mFR8YrA9KnogTJ3gY0= X-Received: by 2002:a17:907:97c7:b0:b73:4e86:88ac with SMTP id a640c23a62f3a-b767153ee6amr706006466b.12.1763836539992; Sat, 22 Nov 2025 10:35:39 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Robert Haas Date: Sat, 22 Nov 2025 13:35:27 -0500 X-Gm-Features: AWmQ_bkxiiWD60uXUC1is4UzKom_M1B6FwoGchHMBdQGmaaA8C_F1s5F9eqkApU Message-ID: Subject: Re: another autovacuum scheduling thread To: Sami Imseih Cc: David Rowley , Nathan Bossart , Robert Treat , Jeremy Schneider , 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 Sat, Nov 22, 2025 at 12:28=E2=80=AFPM Sami Imseih = wrote: > What I have not been able to prove from my tests is that the processing > order of tables by autovacuum will actually make things any better or any > worse. My tests have been short 30 minute tests that count how many > vacuum cycles tables with various DML activity and sizes received. > I have not found much difference. I am also not sure how valuable > these short-duration tests are either. Yeah, I'm not sure that would be the right way to look for a benefit from something like this. I think that a better test scenario might involve figuring out how fast we can recover from a bad situation. As we've discussed before, if VACUUM is chronically unable to keep up with the workload, then the system is going to get into a very bad state and there's not really any help for it. But if we start to get into a bad situation due to some outside interference and then someone removes the interference, we might hope that this patch would help us get back on our feet more quickly. For instance, suppose that we have a database with a stale replication slot, so the oldest-XID value for the cluster keeps getting older and older. autovacuum is probably running but it can't clean anything up. Then at some point, the DBA realizes that bad things are happening and drops the replication slot. You might hope that, with the patch, autovacuum would do a better job getting the system back to a working state. If you set up some kind of test scenario, you could ask questions like "what is the largest age(relfrozenxid) that we observe in the database at any point during the test?" or "from the time the replication slot is dropped, how much time passes before age(datfrozenxid) drops to normal?" or "what is the maximum observed amount of bloat during the test?". The same kind of idea could apply to anything else that stops vacuum from running or makes it unproductive: a full table lock on a key table, an open transaction, a table where VACUUM is failing. I actually don't know exactly what kind of scenario would be good to test here, because I struggle to think of a concrete scenario in which we'd be better off with this than without it (which might be a reason not to proceed with it, despite the fact that I think we all agree that, from a theoretical point of view, the idea of prioritizing sounds better than the idea of not prioritizing). But I think that if the patch has a benefit, it won't be one where the system is in a steady state where vacuum is able to keep up. It might be one where we're in a steady state where vacuum is not able to keep up and things are getting worse and worse, but the patch allows us to survive for longer before terrible things happen. But I would say that the most promising scenario for this patch would be something like what I describe above, where we're not in a steady state at all: something bad has happened and now we're trying to recover. --=20 Robert Haas EDB: http://www.enterprisedb.com