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 1vMnLK-002Hi8-2R for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Nov 2025 13:07:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vMnLJ-00BfKS-0G for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Nov 2025 13:07:57 +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.96) (envelope-from ) id 1vMnLI-00BfKK-28 for pgsql-hackers@lists.postgresql.org; Sat, 22 Nov 2025 13:07:56 +0000 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vMnLG-000rjS-1s for pgsql-hackers@postgresql.org; Sat, 22 Nov 2025 13:07:56 +0000 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-5957c929a5eso3993272e87.1 for ; Sat, 22 Nov 2025 05:07:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763816874; x=1764421674; 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=Wu7ZBPE9H2P5Lo4VaLTr+WK1qkiJyvXWItZzEx0XUhc=; b=O0Qx9zw4EYlZsTvNp9OaI+Z/3Xh9OhQsnnnZbalNTtseejXQOWP4bfOc4lVy+6f/AC 1UuvRbOkg3KDB+M+XwXmxJ0yb4DSaDabZg2ELyK0qAY/pKxM3wEJQdLg8I35+kcS74Rl AhKL2xGoblqqOD76nXtzri3aWsuSFov4gCaZKdGaoSZbr7qdDYykUXi3pRkjNsnQ1Kvs n+9P4x/iltj8HCqrId8OXorvWs7gWJL1DLAoRjHsUgDD5BXFJQzCxFR1tE6UMad640ur 0AQukkCAGI8oOPjjrRBSBKhNBZlmcAnP6fRBJe0W7kuylWgwBi3cMiFWSiQVNb5u6KM7 WKHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763816874; x=1764421674; 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=Wu7ZBPE9H2P5Lo4VaLTr+WK1qkiJyvXWItZzEx0XUhc=; b=Z/sxO//1mzmPr3/6YRRBgNpYg9fF8Yd2ck6ia/JtqXIjOt+9c1O81RafqVJe6m89Xu Iala/alew2AjBzzp/2lGL+YoWnWz22ChvLErCB3RKko4y+qLkX2FtmMI5AE/YiKEfsYQ Wo/2b0yONO8sDEZKpn8q1obbAbdaMVyQIOjcg63MblxmVkUaFnveG2NVgjgXsIQ/Y/s6 mVfvliZKoQVeS821d55pr40X7+RYwUQc1qtHM6np9Ss4d2NT9qbTajHmfRLuoIRFCJHG 6/bPCJ/YBdgP9QKzN3/uKa0qxCeq4ibWFeKrzgME/mov1R0hv906qcq60X6p4p9b15AF 1Mxg== X-Forwarded-Encrypted: i=1; AJvYcCXa+W/8b4NjAIdC2JGe6+VfTX0IXu47jNEF0nEiWxke1yM+SkCl0DzsLnKVlOMB+oyLrNULCrBLoVES7UfA@postgresql.org X-Gm-Message-State: AOJu0YyZnaK2mSwzmpg30YVKAU4EBiAUbo05Gj4cGrp3AXlNKWo+yUI/ QNT8AEU1WPxlqLKo0lEFUjmBN5qTv8ya04ryhVD+KzxpumJqVc18AZgFS+c6fsbCodO9yG2sgNC cu2f/5y4A8X3pib1WpChl/C/If+nvNdA= X-Gm-Gg: ASbGnct/JzNKuzotjN6HUkoy8Aexuu+5+sdBWNtRa9auX/IFIkQVmD7R4n9tEythHmK d54XBz164VuCHYczQA2WvVk6fxtza5l5sLmQg+GlAiytdlK4FYUb8p7GwKuOn923Z7PP+I82kih AsiQiHKyu5simzzWV254/GhLtqKuIzI9dVi26xRxjYq0/8rHhs8wFd+0qegw0o9pmWkZJYcCyFE ctCT2YEODQ2C3vZC2v4XMJJ4M6ktzp/J6WlLkX04zCzbNfiCvdkesv61lJC5ZdRDZvi/dxLPDrd SRU7UQ== X-Google-Smtp-Source: AGHT+IGo+ezWtUJZv3AaC3epQ1ZG02EK6x102EcBDpAzegYrI1oKa4QkpA1UMPM251wIp4Ltu417AC+dY6muGjXHt0k= X-Received: by 2002:a05:6512:15a8:b0:594:2d53:545 with SMTP id 2adb3069b0e04-596a3efdb73mr1679448e87.46.1763816873350; Sat, 22 Nov 2025 05:07:53 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Dilip Kumar Date: Sat, 22 Nov 2025 18:37:36 +0530 X-Gm-Features: AWmQ_bl9m0Hkvbh5-BC_VHIIrmwXK0zRBy5zcXXrMHPQTmr5M5CIcRC8XCh31Hk Message-ID: Subject: Re: another autovacuum scheduling thread To: Nathan Bossart Cc: Robert Haas , Robert Treat , David Rowley , Sami Imseih , 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 Thu, Nov 20, 2025 at 9:55=E2=80=AFPM Nathan Bossart wrote: > Thanks for working on this problem, We frequently hear about the auto vacuuming scheduling issue. I believe this is a great starting point to prioritize based on the wraparound and vacuum threshold limit. However, my vision for addressing this problem has always involved maintaining two distinct priority queues (or sorted lists). Each of these queues would contain tables, with the tables within each queue sorted by their respective scores. Queue 1: Wraparound-Critical: This queue contains tables that require immediate action because their XID or MultiXact ID age is critical, especially those approaching the failsafe limit. Queue 2: Threshold-Based: This queue includes tables needing VACUUM due to crossing other thresholds. Both queues would be maintained as sorted lists, with the highest priority score at the head. The autovacuum worker dynamically selects tables for processing from the head of these 2 queues. For instance, if a table is initially chosen from the threshold queue but processing took too long, and another table approaches its failsafe limit due to a high rate of concurrent XID generation, the latter can be prioritized from the wraparound queue. I believe this 2 queue approach offers more flexibility than attempting to merge these distinct concerns into a single scoring dimension. Tables may exist in both queues. If a table is selected and vacuumed, it will be removed from both queues to prevent redundant efforts. --=20 Regards, Dilip Kumar Google