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 1vEvMg-003mCJ-5V for pgsql-hackers@arkaria.postgresql.org; Fri, 31 Oct 2025 20:04:49 +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 1vEvMf-000JKY-4U for pgsql-hackers@arkaria.postgresql.org; Fri, 31 Oct 2025 20:04:48 +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 1vEvLs-000GpP-Vr for pgsql-hackers@lists.postgresql.org; Fri, 31 Oct 2025 20:04:00 +0000 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vEvLp-005IrR-1T for pgsql-hackers@lists.postgresql.org; Fri, 31 Oct 2025 20:03:59 +0000 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-591c9934e0cso4652743e87.0 for ; Fri, 31 Oct 2025 13:03:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761941031; x=1762545831; 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=7aqo0af5iblF/ThJVVxOcZJ0oy70sDj5HlRfjRRDgDw=; b=SndqkaB05+M5ITd0IRWESVbTvGyuPS3AFIipEcLBwCgWPGBRPj8cNoRE2H2Id0T4Xa IoolTogcjpHKLiBGVSeeL7exivIqhoi0xADZqtuxj2q2YP4y0mm9A7IY7ZfA8P05jdlK 70Kxeuk2IpkHahh6sxz8Vcd8ClkSfMONC940WHOt2S1fpWtQyVY1nG83EYPKG6qea8Y1 gH+vw33tbGdhFVI39drw5HvnNvuBxfmTbhlEQ4h5z4l9oYAcHbxNvbCfu47BJsHa8Juf zWOJ7WGmuSkQx2zyVu7yBL9HqKqvSXoy3s/jDRNHlJy4zb5DyiWIhIy0i8MQVFFIpQPQ OVQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761941031; x=1762545831; 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=7aqo0af5iblF/ThJVVxOcZJ0oy70sDj5HlRfjRRDgDw=; b=DuYEhlVaxsU65lv0LWr8im/Lbb9N74rrNgzYVdRT8UgqbcAHeB1UYsWLFasOfXpgeR 33qBESm7qubkEwWktIoa81F6OoGJ2dcVSZpWGimR1C9gkaSko/2cQL5AXT0NMQJ/7fxc kqukg0DQzQE8O58j1MKhGc1FH8RkSB+5BZQ9uyC8TDU5eQWwaFtn2xY1lYbA+qJ89HcW FbkEoYzA+r8QIjlw9tL3nUEEbF/yp0G5pTqCTA7dlAQnb4XzGMa/40HaHhbVTBLUWjjq xo0Akw8cgD7odjek3LuksaQAFxBDIHHm9IO8zemAijlF64UK4v5LXSFoDBKreqLHAdI4 o/Dg== X-Forwarded-Encrypted: i=1; AJvYcCXtlNJOZHsD+LInGdxlQ4qgznQKL8UhkwQQQul7LwQSULdg+wpbsa95GnQlLqK7wJVb5o/Gp1HjBdYjjI02@lists.postgresql.org X-Gm-Message-State: AOJu0YyGvnMTvQXYZc5sdD0k/Y3uhOLpeq4yXGDlrwGD+d1QO3aqGhsS Nz7E9HROYtAC2PUhcbmMVIINUGEYMyyRW4/3C8spggKfGj14BoXhpCQ8AP2EJ5uduhVUXDIJ48O XIePuzGZRdyXaxBHkG3bqmBmPpMG2THo= X-Gm-Gg: ASbGnctYdGm5mkWWsNN53CDuOutbaST36ZVhgeyAJs8Qhd/EjfmYo3bkKYbTjOUJadn ifCU3o8x76dT0obVIEwgxsR9w1rrtcoE5acacl1WLxNLbgEeBQzl+vSpIHR2EbliDojFOxDRWs9 bf2LCx/KN684zr/tdHejLjkZ+tfr5QOhQDt3Zpm3Tl2qd1gXed2p5BaFHApo0s38R8JfaELIKpK 3FgUS66rshhrO2PxsEFF5C40qrk5EvIx4wD7KbBssk35xYYUTKEkJT3t1io8Q== X-Google-Smtp-Source: AGHT+IGUNI0xN6wpnxynwea9CLRXki8o+Zluh04uU/7/MdwkjDVoSruuyDE86BOQZJrBT9ozxQ/vwfdKEb+0zwhgzMI= X-Received: by 2002:a05:6512:3c92:b0:579:ac00:1f20 with SMTP id 2adb3069b0e04-5941d4eed2amr1800069e87.2.1761941030855; Fri, 31 Oct 2025 13:03:50 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Masahiko Sawada Date: Fri, 31 Oct 2025 13:03:14 -0700 X-Gm-Features: AWmQ_bkeDcmBrmtJGKyxj_8_N3KS7vKNeF4FYzffQ71bXHgJvSc9vI-9Zuhvl1M Message-ID: Subject: Re: POC: Parallel processing of indexes in autovacuum To: Daniil Davydov <3danissimo@gmail.com> Cc: Alexander Korotkov , Sami Imseih , 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 Tue, Oct 28, 2025 at 6:10=E2=80=AFAM Daniil Davydov <3danissimo@gmail.co= m> wrote: > > > > > IIUC the patch still has one problem in terms of reloading the > > configuration parameters during parallel mode as I mentioned > > before[1]. > > > > Yep. I was happy to see that you think that config file processing is OK = for > autovacuum :) > I'll allow it for a/v leader. I've also thought about "compute_parallel_d= elay". > The simplest solution that I see is to move cost-based delay parameters t= o > shared state (PVShared) and create some variables such a > VacuumSharedCostBalance, so we can use them inside vacuum_delay_point. > What do you think about this idea? I think that we need to somehow have parallel workers use the new vacuum delay parameters (e.g., VacuumCostPageHit and VacuumCostPageMiss) after the leader reloads the configuration file. The leader shares the initial parameters with the parallel workers (via DSM) before starting the workers but doesn't propagate the updates during the parallel operations. And the worker doesn't reload the configuration file. > > Another approaches like a "tell parallel workers that they should > reload config" > looks a bit too invasive IMO. > > > Thanks everybody for the review! Please, see v12 patches : > 1) Implement tests for parallel autovacuum > 2) Fix error with unreleased workers - see try/catch block in do_autovacu= um > and before_shmem_exit callback registration in AutoVacWorkerMain > 3) Allow a/v leader to process config file (see guc.c) > Here are some review comments for 0001 patch: +static void +autovacuum_worker_before_shmem_exit(int code, Datum arg) +{ + if (code !=3D 0) + AutoVacuumReleaseAllParallelWorkers(); +} + AutoVacuumReleaseAllParallelWorkers() calls AutoVacuumReleaseParallelWorkers() only when av_nworkers_reserved > 0, so I think we don't need the condition 'if (code !=3D 0)' here. --- +extern void AutoVacuumReleaseAllParallelWorkers(void); There is no caller of this function outside of autovacuum.h. --- { name =3D> 'autovacuum_max_parallel_workers', type =3D> 'int', context =3D= > 'PGC_SIGHUP', group =3D> 'VACUUM_AUTOVACUUM', short_desc =3D> 'Maximum number of parallel autovacuum workers, that can be taken from bgworkers pool.', long_desc =3D> 'This parameter is capped by "max_worker_processes" (not by "autovacuum_max_workers"!).', variable =3D> 'autovacuum_max_parallel_workers', boot_val =3D> '0', min =3D> '0', max =3D> 'MAX_BACKENDS', }, Parallel vacuum in autovacuum can be used only when users set the autovacuum_parallel_workers storage parameter. How about using the default value 2 for autovacuum_max_parallel_workers GUC parameter? Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com