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 1v6dmO-007gMo-RL for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Oct 2025 23:41:09 +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 1v6dmM-00DjnU-HC for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Oct 2025 23:41:07 +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 1v6dmM-00DjnK-3o for pgsql-hackers@lists.postgresql.org; Wed, 08 Oct 2025 23:41:07 +0000 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v6dmI-0017j7-0I for pgsql-hackers@postgresql.org; Wed, 08 Oct 2025 23:41:06 +0000 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-3304dd2f119so342489a91.2 for ; Wed, 08 Oct 2025 16:41:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ardentperf-com.20230601.gappssmtp.com; s=20230601; t=1759966860; x=1760571660; darn=postgresql.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=xda5EySjy2LDUVBDwtUPaG3LdN469ENGx6Uh0bFZb/w=; b=Fq+cItF2KAs/FOLVvIPuG2OhJsNDjJ3I0aVQvWrHvi+13lyMzicYxtB08jWpBMemz0 nzzYl/wa8xbDzQiCBaVh/O9j1l5IaSWWDJB4TQOuep0jNUuGZrB7cchqqCl6OzO7TXFE uvE8RfGeXjF6t+qh+MZTYeitV0Fn/1NvZcs/oHcwZju3pqrNSUxAHlxxIPHh2PpmXM0e cqUhKzPj4XkClK5CDVpYXYW9oRh5Id7DmgHNAk6tH+1MQmDcMTggLSKaiJNxJvncWttp pymgUXUhhoWYJZDAYiJU1e2RUMisx1nZFsdsWhr64uQN3oGYts60W+W4eh7diB4aI+zV VxNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759966860; x=1760571660; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xda5EySjy2LDUVBDwtUPaG3LdN469ENGx6Uh0bFZb/w=; b=wtO25AKfS68WhUZ3aK9+J9hjNyWdx5PeqGnayJGEkGfcU08hWsGSuhmhX/NYSD0t2S +LcPkPYxWHBW/edZVH5I4H/hId1GdQUeOlR9WBDtfukZ3LUzl1ROsti9pHiM4NOnldDh OeAU/xSi7AZajUYDcJP+t8+7tp2IkPywtWsz555wFucN6pj9YYqfaHjNqFaFsB2b4PH7 7Ub+iaSe5KI6W/QiS4wiLOtH9c2W3nrsQXGizyIHmckVh1++XZKti/n3VehOKYevVwXy 6ePMkd6KKKBot7oxUzxCnLGCtWkBpqb5S/ZlWpWjAwMyHI+5NeGdiCDzSKjQKbgwCeMM Pq9g== X-Forwarded-Encrypted: i=1; AJvYcCWjoeeQK9RKPiGZCCJhVHTrJ0yfIV0MCOnL15UpCtk6H9KNoGBy7pzDnv+XspMe8WoxLN/iEqDOXFcWZaDF@postgresql.org X-Gm-Message-State: AOJu0YzJMtRtIhh02bFuLAceksri44e+PcxusDYyyuNZqZWFPapQCMvt ZDIQJ/rfE16+iGE15nPqd4o8gOPLNsn7bRL5WhzllLVAaIVP0ddD79YSU0zYpSnDvQ== X-Gm-Gg: ASbGncvgykYi9Ei4GL79y6LdeEMyjjJRSWWvtU0XJAjZDnhvwdb4ErbJZXnEYgxJGzs vlRHwm1/WGiOGdKCtoTSW2j2qMJHAikMc5RcaTbIZs8sjoPNTmvWO43vqFk5VYbS04Al3+pdK41 MdTtqSYLEOxN24CjDoA+qEWKYyqmZWRy5IGOjhpzM5VO28yVaIZU+BtX2f7h+ug3yBJcvFJ3ta/ LdIIzDMIY2KIko/dazeoMNogFElnTIv7LuRbEmNI3gBtnabvLVG1sVQCoa9zr1WNNWuRguQUvsN Xk/fFqlpW5TC4FZWjWPO8igSasq/7XH6AkBbHdSy0be5qTyVxHG9yjKVjarWRlcsPo7Bdvg16Og E18jb6tPs2H0cUdSoTdjWYnsd9ebq95/J+Uv/Vw6aaDLGMXjRNRXdSudY09spkKKlg9e3ecNFYv 2g97JqxWX+95Jimyt3H5Vv7Q== X-Google-Smtp-Source: AGHT+IEtuS++Bu5UK0QbVZhArw6KnLgBk3TYBvmoGaQSTgkzyi+WmH6uzl52LmGsM93/E65f6Eb/8g== X-Received: by 2002:a17:90b:17c2:b0:327:734a:ae7a with SMTP id 98e67ed59e1d1-33b5114ac35mr7337128a91.11.1759966859600; Wed, 08 Oct 2025 16:40:59 -0700 (PDT) Received: from ardentperf.com (97-113-159-222.tukw.qwest.net. [97.113.159.222]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-33b510fc5e6sm4838225a91.6.2025.10.08.16.40.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Oct 2025 16:40:59 -0700 (PDT) Date: Wed, 8 Oct 2025 16:40:57 -0700 From: Jeremy Schneider To: Sami Imseih Cc: Nathan Bossart , pgsql-hackers@postgresql.org Subject: Re: another autovacuum scheduling thread Message-ID: <20251008164057.6bceb9ed@ardentperf.com> In-Reply-To: References: MIME-Version: 1.0 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 Wed, 8 Oct 2025 12:06:29 -0500 Sami Imseih wrote: >=20 > One risk I see with this approach is that we will end up autovacuuming > tables that also take the longest time to complete, which could cause > smaller, quick-to-process tables to be neglected. >=20 > It=E2=80=99s not always the case that the oldest tables in terms of (M)XI= D age > are also the most expensive to vacuum, but that is often more true > than not. I think an approach of doing largest objects first actually might work really well for balancing work amongst autovacuum workers. Many years ago I designed a system to backup many databases with a pool of workers and used this same simple & naive algorithm of just reverse sorting on db size, and it worked remarkably well. If you have one big thing then you probably want someone to get started on that first. As long as there's a pool of workers available, as you work through the queue, you can actually end up with pretty optimal use of all the workers. -Jeremy