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 1vH93K-00F8Wc-6i for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Nov 2025 23:06:02 +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 1vH93H-00Anun-MY for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Nov 2025 23:05:59 +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 1vH93H-00Anue-Ad for pgsql-hackers@lists.postgresql.org; Thu, 06 Nov 2025 23:05:59 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vH93F-005nsD-2P for pgsql-hackers@postgresql.org; Thu, 06 Nov 2025 23:05:58 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-591c98ebe90so145722e87.3 for ; Thu, 06 Nov 2025 15:05:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762470356; x=1763075156; 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=h5HlnzMmoVAqn/R4aS2zMeF+yN6ha5s1HjJA1jROTaY=; b=KPh6iI5WSUkL35WTlK8JoK+CaGQ25uMFZr2v6ycEZnbb1wWl+tWfLWfrJV+meMRJA/ XB+7mAUoqTT/Dbz1VGa1+jbaz+B727blp1AiYNhfmBYxpkhKbDA0lZLWUktf66EQWJ/r cjIkzwV97Q8TpO4Hx6aENxAibefOp3bvESPMNO2qtWVfgUs8+onK7AJFOOQlvbwpycDG HN4/ptPLhvdrkVTg+gTRaxfp+qRIBYSf6BN+5ykkV3R/Mwu186ll0WLS5rfa4Bjx7Cg2 aoBvPQvDCzN6isE77fp1PaZ2/P2IsOPeZDY+N7yotUflN9GKMv4iJWhKfnAhtdTcWXhH fd9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762470356; x=1763075156; 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=h5HlnzMmoVAqn/R4aS2zMeF+yN6ha5s1HjJA1jROTaY=; b=JWfVlkz2PqXH0OXyZaQNO1YYKDEkl6IHsAX5aGnsK0sff5gKpAJzheNogwlVM0b644 ABqwbAQ68QzCQ+yuc93w//uyHU4Nq19SUegYTRfl09dUZPVwDut6BhIu+j9R0qJ03WRH Rd0245qOPeqpNZwlh1MAyX4uZmSjp0oaJYO4b5U38WrWycoOoqdEI07BP+C4cfh+vnXf eFstotpodYM+dkMJbWWnyRzr9UoofTHHexHHqv6Bqfh09eZfzwCMf8icWP+cd+AhTzsL DJC2QNgd652OnAqsMFSNMBjO/9Mmtgw01qa4XxeQdtkqxViEe6dsbIj+idz0b6CcycR6 Js0w== X-Forwarded-Encrypted: i=1; AJvYcCUO3B1biOdTlBjhZ6DXd8t3nE+I2Ugqo4fC12dYvoB5XJnBWyygY7TQ24nskC1bhRbXtGedjpyb3tcLAur4@postgresql.org X-Gm-Message-State: AOJu0YyOJUDU7BdxjsUf41ySpZD6Mhm348UcaXo9cnxCEK5BqNg7EWEc Pzv+k7OeVa42UzntiMD32qjHVi1vmPsVWm6XqPHIy2ql3o1Z0Cbe+WcpR0CXfMzHnTYhpKciRbJ YGnCfWThsfuKL6yzvrd3kZkQHtXqgPpM= X-Gm-Gg: ASbGncu0pL67HrNO1GJLL+qAS5rrH75mP564rbXyQJ+QyPuPEPKtwvUWECB2r+OWaGx TxrnJQvpj33mu1nl1+4DrsdLitQCJP+FJnm9I/DqV1mX44XWekX+qTG51Zgw4FNJX+m8PQS12ZT neIn3ut9B2XzHRCji0OAtu5WayCslVrd9bF9WQ0RUPTLaxRPowXk28rV3Zl0WsCFyW5nNMWjgyj Z7/z34cxjS5ADcgi7JMTs1TSe+UUrQbcrcD94lGJaY+Unme9tovFJfaI7MFB163+eX+5jL+BlpW hpLv7aDmqrGIleTJvZsN/cYJA5W3UdadtpDnFzmjtyKBTy+g6MI= X-Google-Smtp-Source: AGHT+IHccBMG//nEKAxRmLWen/+GTT25uxTdgp+AYmpWGgbBQpQ/6XucfUHYAsqAiR0lAPM30e+IKqWRYuV+xqgdHF8= X-Received: by 2002:a05:6512:6c7:b0:594:2e7e:7897 with SMTP id 2adb3069b0e04-59456b8c535mr269720e87.29.1762470355662; Thu, 06 Nov 2025 15:05:55 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: David Rowley Date: Fri, 7 Nov 2025 12:05:43 +1300 X-Gm-Features: AWmQ_bmnlsaVnhjQPlZ1ShCuadampxYEsm3XL7fhFzUfnQCL6h1FgiN6shiwrxc Message-ID: Subject: Re: another autovacuum scheduling thread To: Sami Imseih Cc: Nathan Bossart , 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 Fri, 7 Nov 2025 at 11:21, Sami Imseih wrote: > Also, I am thinking about another sorting strategy based on average > autovacuum/autoanalyze time per table. The idea is to sort ascending by > the greater of the two averages, so workers process quicker tables first > instead of all workers potentially getting hung on the slowest tables. > We can calculate the average now that v18 includes total_autovacuum_time > and total_autoanalyze time. > > The way I see it, regardless of prioritization, a few large tables may > still monopolize autovacuum workers. But at least this way, the quick tables > get a chance to get processed first. Will this be an idea worth testing out? This sounds like a terrible idea to me. It'll mean any table that starts taking longer due to autovacuum neglect will have its priority dropped for next time which will result in further neglect. If vacuum_cost_limit is too low, then the tables in need of vacuum the most could end up last in the queue. I also don't see how you'd handle the fact that analyze is likely to be faster than vacuum. Tables that only need an analyze would just come last with no regard for how outdated the statistics are? I'm confused at why we'd have set up our autovacuum trigger points as they are today because we think those are good times to do a vacuum/analyze, but then prioritise on something completely different. Surely if we think 20% dead tuples is worth a vacuum, we must therefore think that 40% dead tuples are even more worthwhile?! I just cannot comprehend why we'd deviate from making the priority the percentage over the trigger point here. If we come to the conclusion that we want something else, then maybe our trigger point threshold method also needs to be redefined. There certainly have been complaints about 20% of a huge table being too much (I guess autovacuum_vacuum_max_threshold is our answer to trying to fix that one). David David David