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 1uIFDv-000sou-CR for pgsql-hackers@arkaria.postgresql.org; Thu, 22 May 2025 23:21:15 +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 1uIFDs-00ALMo-QI for pgsql-hackers@arkaria.postgresql.org; Thu, 22 May 2025 23:21:12 +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 1uIFDs-00ALMg-AS for pgsql-hackers@lists.postgresql.org; Thu, 22 May 2025 23:21:12 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uIFDp-000OFm-3D for pgsql-hackers@lists.postgresql.org; Thu, 22 May 2025 23:21:11 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-54b166fa41bso12979105e87.0 for ; Thu, 22 May 2025 16:21:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747956067; x=1748560867; darn=lists.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=9eifr/EcaRmnLLoAluZKvCFlYt7qj4rW/wJpI2LeYzk=; b=O7xi4ZcPxpQPsAfzbz2BPbG1+eYUhZ9wYFHAMp68IBLoeKnUvl5nmn7r5ak44oQRsc KFeyxjQJgPqxOl4SrdYnGyigy788B5N4uZXqeqjMbuAObVgbmswxnsWc5rBHqf0ZLqPQ qddpxWONauxIkF/0M9A39um3+ACc5Y+t7Q/wlNj1q5qTbz+SlcsqiC/zS1IdA+hOZk0V TkAvUfS/hDoyEdAcrbUfv12O43rtsbe8T4leEwZIwciroPUsNYmgkdqnXsSNq93ar8uu arqeZ6hzDwgDh5+fI4WKNZ8/2rkauGERJCFeEknIX/2oEh0zBCrWACfdAU6XMN1+htsE IgdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747956067; x=1748560867; h=content-transfer-encoding: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=9eifr/EcaRmnLLoAluZKvCFlYt7qj4rW/wJpI2LeYzk=; b=PaZuPUkpCWNL0WItaCtQ6HD9XeQTpob7WoTiO5XuAUHsm+0zPAaESs1kg/rc0rDxsd iHOsHa6tQ9vKJJ5wmnSxD1I+dUpp0u6oVKNp9tlu6wwLa3h5WCGl3N9ywXbA50V8OKmM Pz+yT6SBC7l6bwkP5QKD0UbI/Pa9ehDaQiw+/VsdupvF0Z/zQC6KoqB8eU5i1ddjlSir dmArFZ4Zw2yjX396GUG0EEM7XHJ227sv81vPT2lykG9PsmArS+02mDuWpt7DpU8j4DIG J3U9vtu5wRY6J86rJmB2qIDiFQZNPaT1M/hIteKzGuaDEXn2z8bulr5FQ1OPxx72pfnE zO4Q== X-Forwarded-Encrypted: i=1; AJvYcCWZmtLKhZ7UQczeNBHoEL3NbbYHPpuixAWVHkZorqAxhKT5w+MYqaT87QXuGDPO9/hgRRxAMF3H8aR07s/1@lists.postgresql.org X-Gm-Message-State: AOJu0Yzbhpc4IU1PBL0J3PxOZQZPDra0oH67z+ZKGdjN0rNwnTqRVr3Y TIFXc6eog/YbJUNy1HQW+S60m2VxX7jDIXrNnZTmOJ+8vuohW5d2ZXdVgbScLmR8R1S27hxQXrc cjUjIFYNxaOr3WHHWY1XPMKfRFKRURME= X-Gm-Gg: ASbGnct+JB/yzwa+Da+qTsktki2c7auMbAo0Q/b7g78RJD1/KixZonncA/PbJQNvNY8 EAV/e8g0sfairZc4mMQWqQK1J3ZFFzN1mQKn76rXWTSzpn1JeJBOV4U0Q7/q4oRaIvodmL51Sc/ BeCBFY8FgByt85awkxAICzBuJeVjIejZyBjA== X-Google-Smtp-Source: AGHT+IER7S1udrQo0/9ECaGwY6VbSZOdbgeXZVrlqMSYsCUKmttzLdamiR5D7MVGDUTRmqDD57Yr+ZTElH2VaRJ0gck= X-Received: by 2002:a05:6512:1096:b0:54e:819a:8325 with SMTP id 2adb3069b0e04-55216e0d1bbmr151456e87.15.1747956066630; Thu, 22 May 2025 16:21:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Masahiko Sawada Date: Thu, 22 May 2025 16:20:30 -0700 X-Gm-Features: AX0GCFuHRsorPDRl6E8Ej8sL9TJBwBw5xhMYnJeaywxVEg--KubOWlhf5_mNhuQ Message-ID: Subject: Re: POC: Parallel processing of indexes in autovacuum To: Sami Imseih Cc: Daniil Davydov <3danissimo@gmail.com>, Matheus Alcantara , Maxim Orlov , Postgres hackers 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, May 22, 2025 at 10:48=E2=80=AFAM Sami Imseih = wrote: > > I started looking at the patch but I have some high level thoughts I woul= d > 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 woul= d > > > 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 thos= e > that are used to support parallel autovacuum. At the end of the day, thes= e > 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 agree that parallel vacuum workers used during autovacuum should be capped by the max_parallel_workers. > > 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. +1 for the reloption having a number of parallel workers, leaving aside the name competition. > That is > acceptable, and a/v logging > ( and perhaps other stat views ) should display this behavior: workers > planned vs workers launched. Agreed. The workers planned vs. launched is reported only with VERBOSE option so we need to change it so that autovacuum can log it at least. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com