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 1uIA1p-00Gr26-Er for pgsql-hackers@arkaria.postgresql.org; Thu, 22 May 2025 17:48:25 +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 1uIA1o-005zKA-DI for pgsql-hackers@arkaria.postgresql.org; Thu, 22 May 2025 17:48:24 +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 1uIA1o-005zK1-1m for pgsql-hackers@lists.postgresql.org; Thu, 22 May 2025 17:48:23 +0000 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uIA1l-000Nek-0C for pgsql-hackers@lists.postgresql.org; Thu, 22 May 2025 17:48:23 +0000 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-3105ef2a071so96735951fa.1 for ; Thu, 22 May 2025 10:48:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747936099; x=1748540899; darn=lists.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=10TgAjblID7Fjn481R6qh2cG3WYoKrq5KyleOlGhljg=; b=U9dTYL0YXOONpBJDdlAw55JZ53KoxxMO0EFkghuMMnU5EIwrBVf6DNjlFt5tiS3N3V 6Wy7u4P4jwJKxOSGU+zJz+VpEdvr/sqwK/6v0mQRCiKQpyNMF/3d2CyiodPvgLZ5gdF/ bmSXByJEAbHoTrqX7vrB4oQuqgm/RFBmZnMIe1l9n7WPy05ZzpB9/nrrUc+0HLz831HZ CvaX76XAJoCRtBjbEv6QF+C3KEcnX1T6ynW7smJTTNUXIUb2OhSDgdK2GDKKb2kDgvSb oVNx+mQpAN17+pjaEhZ9TsTpJv5e7pksubN/TL3OXVhpAWECBumS6OPgx33TKnYHB1mN ObaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747936099; x=1748540899; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=10TgAjblID7Fjn481R6qh2cG3WYoKrq5KyleOlGhljg=; b=T7ceLFHQTYKq0GQHMrc3/KP9yhYTaEWlevPJJDg5nuKu4fCMDUXUfvoO7Spn9A5hLE ueopQnUh8Mk6v9CRYIhMqqFmQ7achi6rN1qxAuWl/14sikyxfsNY46KeHzjsGeeHociv p6mvqnYYZ6vtWy1hq2nJ+Z1rHOkx/7+GfJfsRVqaCSvgAgKqbWjAa0E6SQijXVh3vXQp aOpvjj5aQ8fqS+AcqxDL5zKD7lp7Z45QDSfHWZQVoWmGyZxX4KlIRijDQ0Cy+C/uY2EJ geim5qCX7FU8gt25QlN9vo/n98xjFt2zDJdDP0e28o3K/esrv5EGVKD9lZQDBt04oZTf tUFA== X-Forwarded-Encrypted: i=1; AJvYcCXWbVduEXbQO9XFI1dmH/K1gI+5aWF2X5WVWkcUYoCKhFGanpbuChMiyL+K+skshpAVZLogf8luHWErHXVK@lists.postgresql.org X-Gm-Message-State: AOJu0Yw4YkIMoPKS8+rypjkT8YdnBY2DSiUHQx99UIZf6MKsep+WB7WE DIm4z0GQ5QqqtDwwg6QWaFKhoL3xX4oQI+RM2boMFauGmBkwAi3wpEz5rVe2P2J1ioU8RENf5zh JbcxepfsQGgtT42IJ1M0QJaI2o925yw0WjwRI X-Gm-Gg: ASbGncv5rRvuLdw2Ryf0C3JizX6ETdEBDXcAHxh/7MFlY0A+6m8BUiZy/Db+xQhaA8/ sKuUIH9asvedA31bMtwaXbRH9Z+vjuopO+9A7NVp4FhzhYhX6HGFXF6wIZHFplBRa9+8Aw70yYM NdWI2UyfdwwwvlwPhVSk1Dq3LASC0JGKuq X-Google-Smtp-Source: AGHT+IHB5uxBspYzUc3GeZdZ7y/GXsUEMSWmrcLUSs1bkLTlvbufWZflu0kS/M5+CVy2fhy2g16cmka36dbumfrFhUc= X-Received: by 2002:a05:651c:4087:b0:329:799:5eb8 with SMTP id 38308e7fff4ca-32907995f3dmr59231681fa.36.1747936098940; Thu, 22 May 2025 10:48:18 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Sami Imseih Date: Thu, 22 May 2025 12:48:07 -0500 X-Gm-Features: AX0GCFs8NOmCw3o_BIysDgZgFnPnSTpKuen2I8zR6-Y4QQjWNbCsVbKGNGZlEE8 Message-ID: Subject: Re: POC: Parallel processing of indexes in autovacuum To: Daniil Davydov <3danissimo@gmail.com> Cc: Masahiko Sawada , Matheus Alcantara , Maxim Orlov , Postgres hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I started looking at the patch but I have some high level thoughts I would like to share before looking further. > > I find that the name "autovacuum_reserved_workers_num" is generic. It > > would be better to have a more specific name for parallel vacuum such > > as autovacuum_max_parallel_workers. This parameter is related to > > neither autovacuum_worker_slots nor autovacuum_max_workers, which > > seems fine to me. Also, max_parallel_maintenance_workers doesn't > > affect this parameter. > > ....... > > I've also considered some alternative names. If we were to use > > parallel_maintenance_workers, it sounds like it controls the parallel > > degree for all operations using max_parallel_maintenance_workers, > > including CREATE INDEX. Similarly, vacuum_parallel_workers could be > > interpreted as affecting both autovacuum and manual VACUUM commands, > > suggesting that when users run "VACUUM (PARALLEL) t", the system would > > use their specified value for the parallel degree. I prefer > > autovacuum_parallel_workers or vacuum_parallel_workers. > > > > This was my headache when I created names for variables. Autovacuum > initially implies parallelism, because we have several parallel a/v > workers. So I think that parameter like > `autovacuum_max_parallel_workers` will confuse somebody. > If we want to have a more specific name, I would prefer > `max_parallel_index_autovacuum_workers`. I don't think we should have a separate pool of parallel workers for those that are used to support parallel autovacuum. At the end of the day, these are parallel workers and they should be capped by max_parallel_workers. I think it will be confusing if we claim these are parallel workers, but they are coming from a different pool. I envision we have another GUC such as "max_parallel_autovacuum_workers" (which I think is a better name) that matches the behavior of "max_parallel_maintenance_worker". Meaning that the autovacuum workers still maintain their existing behavior ( launching a worker per table ), and if they do need to vacuum in parallel, they can draw from a pool of parallel workers. With the above said, I therefore think the reloption should actually be a number of parallel workers rather than a boolean. Let's take an example of a user that has 3 tables they wish to (auto)vacuum can process in parallel, and if available they wish each of these tables could be autovacuumed with 4 parallel workers. However, as to not overload the system, they cap the 'max_parallel_maintenance_worker' to something like 8. If it so happens that all 3 tables are auto-vacuumed at the same time, there may not be enough parallel workers, so one table will be a loser and be vacuumed in serial. That is acceptable, and a/v logging ( and perhaps other stat views ) should display this behavior: workers planned vs workers launched. thoughts? -- Sami Imseih Amazon Web Services (AWS)