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 1uAyrr-004rVz-Kz for pgsql-hackers@arkaria.postgresql.org; Fri, 02 May 2025 22:28:28 +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 1uAyrm-00C250-JY for pgsql-hackers@arkaria.postgresql.org; Fri, 02 May 2025 22:28:23 +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 1uAyrm-00C23w-97 for pgsql-hackers@lists.postgresql.org; Fri, 02 May 2025 22:28:23 +0000 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uAyrl-000l1W-0K for pgsql-hackers@lists.postgresql.org; Fri, 02 May 2025 22:28:22 +0000 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-30beedb99c9so21178091fa.3 for ; Fri, 02 May 2025 15:28:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746224897; x=1746829697; 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=LKg1Zk7s1s+vmQB+XbMyyDB2PgQJVEUEGhmL5SgbPEU=; b=g9tz06gmIrqM94i+2oQonMZoH1QNVVtbC0uB+bh9lLKaS/xxOin7B0LOBGzXRuGPtb huUU8McE49+AhrA+F2mPvUTc30CHxXOZvc4WycjwQpUwqZxpibi/qoDC1rdVopb5NqM9 ZR0dlJ/EVog0vtDTwoWOU4S2+RvIRxrKb7IYMYckNDTQu+ew4JhCjAKqG0lNhFQSYmVm c2c9WFCTElmW/4RvQ+HGAOGrjKnutKuNSqKNEBGWpWpM4NcDzEqglF/LcQvvxLETvhP7 9M3FcySAVuUgplvvL+U3cPoXwa/OR/jK6gTHdzV7Xj5eMUw65cXHRm1BPD4PP0poxPoE Fksw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746224897; x=1746829697; 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=LKg1Zk7s1s+vmQB+XbMyyDB2PgQJVEUEGhmL5SgbPEU=; b=frrm6RiHpQ8uM/ZYlkYDraMnKGXzpasI3IQdRB43DvptushJTMYL3tEX61Y1Cf4E/C qVAcmLS7ulGN2sDcfkUQ0yoA2N+y/SRc0jYXNmr2DGOkgn7kWlgcnZmKJ0XHaPrRbiLI o8Fzb7zTU+5FMsqjtAc94mk+Zp8w+h9R36hMOHXTNnsOITktQ/woxOkv+s9t7UUq/V55 JYqaaI4Lavnv/it0jDIhc1o8COvnxyNnjweeVeb4b2bSKDv7oncXu/4plZrX8E+AffXm qzLHkvuZ12tzPWz/ha76r7yLDnN36jw8K5hACFwhtWHDRH6PM9XaazYk/xQf1GPQ62vm DpZg== X-Forwarded-Encrypted: i=1; AJvYcCW9orxu1VjMCtGm3zaDAeWEe4SGMSXPvdTYyI8/t4QdZa193kR5A2i9Vy4/1poOtHezLA+cNx5+VCn+kPgk@lists.postgresql.org X-Gm-Message-State: AOJu0YyJKNOJumk+Kuqrs6iStJkYECZsAINyK8IpsItp1jrlIxzMSPKe uAXTLLUX1rPMAKK1xIlEio5eBXnT1UIpvF7Cb231FXAuuqHY9y6Ge8izkz1nPOhFAOr3zftiZVt /4CaFCTmbX9q4RRx53+QG5MTXsCQ= X-Gm-Gg: ASbGnctkOWrf2gTwAOcanwZXCZr+aUubukHtbV48QYkhebkNkGoCYY3N0uaIKdl5OaM i/YNgx6tnFCRoWmdt34UR4vgJ6v71rlgOR57hE2mvMCoKnNp2gYNUrs52tWu3kmOAMd5K9nm+gs WyXk4Jro3CvNyHElyPexW39EI= X-Google-Smtp-Source: AGHT+IE7UtTp1fkzfUG2txWmmww1pQPtfEJOMi2yBRL1L6bmbte4UuooFlow+uXuROhUcY7FbZZMxwOSFrQLuntJlaA= X-Received: by 2002:a05:651c:a0b:b0:30a:448a:467 with SMTP id 38308e7fff4ca-321db695309mr2789031fa.21.1746224896833; Fri, 02 May 2025 15:28:16 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Masahiko Sawada Date: Fri, 2 May 2025 15:27:40 -0700 X-Gm-Features: ATxdqUGaHyxiEndSrOFgx7Wxrnty_Mfg8t2BIY6EkRgajobMzsj3OxMqb4asXsc Message-ID: Subject: Re: POC: Parallel processing of indexes in autovacuum To: Daniil Davydov <3danissimo@gmail.com> Cc: 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 Fri, May 2, 2025 at 11:13=E2=80=AFAM Daniil Davydov <3danissimo@gmail.co= m> wrote: > > On Thu, May 1, 2025 at 8:03=E2=80=AFAM Masahiko Sawada wrote: > > > > As I understand it, we initially disabled parallel vacuum for > > autovacuum because their objectives are somewhat contradictory. > > Parallel vacuum aims to accelerate the process by utilizing additional > > resources, while autovacuum is designed to perform cleaning operations > > with minimal impact on foreground transaction processing (e.g., > > through vacuum delay). > > > Yep, we also decided that we must not create more a/v workers for > index processing. > In current implementation, the leader process sends a signal to the > a/v launcher, and the launcher tries to launch all requested workers. > But the number of workers never exceeds `autovacuum_max_workers`. > Thus, we will never have more a/v workers than in the standard case > (without this feature). I have concerns about this design. When autovacuuming on a single table consumes all available autovacuum_max_workers slots with parallel vacuum workers, the system becomes incapable of processing other tables. This means that when determining the appropriate autovacuum_max_workers value, users must consider not only the number of tables to be processed concurrently but also the potential number of parallel workers that might be launched. I think it would more make sense to maintain the existing autovacuum_max_workers parameter while introducing a new parameter that would either control the maximum number of parallel vacuum workers per autovacuum worker or set a system-wide cap on the total number of parallel vacuum workers. > > > Regarding implementation: I notice the WIP patch implements its own > > parallel vacuum mechanism for autovacuum. Have you considered simply > > setting at_params.nworkers to a value greater than zero? > > > About `at_params.nworkers =3D N` - that's exactly what we're doing (you > can see it in the `vacuum_rel` function). But we cannot fully reuse > code of VACUUM PARALLEL, because it creates its own processes via > dynamic bgworkers machinery. > As I said above - we don't want to consume additional resources. Also > we don't want to complicate communication between processes (the idea > is that a/v workers can only send signals to the a/v launcher). Could you elaborate on the reasons why you don't want to use background workers and avoid complicated communication between processes? I'm not sure whether these concerns provide sufficient justification for implementing its own parallel index processing. Regards, --=20 Masahiko Sawada Amazon Web Services: https://aws.amazon.com