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 1uCAfI-00BWr3-EY for pgsql-hackers@arkaria.postgresql.org; Tue, 06 May 2025 05:16:24 +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 1uCAfG-006rZJ-62 for pgsql-hackers@arkaria.postgresql.org; Tue, 06 May 2025 05:16:22 +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 <3danissimo@gmail.com>) id 1uCAfF-006rZB-SQ for pgsql-hackers@lists.postgresql.org; Tue, 06 May 2025 05:16:21 +0000 Received: from mail-yb1-xb32.google.com ([2607:f8b0:4864:20::b32]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from <3danissimo@gmail.com>) id 1uCAfD-000OQv-0c for pgsql-hackers@lists.postgresql.org; Tue, 06 May 2025 05:16:21 +0000 Received: by mail-yb1-xb32.google.com with SMTP id 3f1490d57ef6-e7387d4a334so4251220276.2 for ; Mon, 05 May 2025 22:16:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746508578; x=1747113378; 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=DxN2xt1kZKeXI3lAcxc6uYyjHPG48y1wN3B/daO0PK4=; b=Nu5snDZa5ODcXeOY+6wIxFkMpSauwMVMx+UyKrxFj34/lwW56ehBWoXiykOOZvuspl /7wojUb/ay2OH5rn9Ti447SG/tknfXs8AQw0ONfbTpzpxwMA/vBwxpVAdhR3gH7bpOft VQFYWyOfBRIgssCasQ6wfV/+xTZxWNSvH/2tJxq5jMbf7xN7hMKghgPZUo+NK6qfSFdy mzvDZ+TzHz1aWAaIfTVXsFt1J0lKYGFd9D7mC6yICRHt8hx3LjFylTnbJwGVAK5zd9Kj HH1aINIjjkwmjXKYlmcG7uTWepbY5QKqgr/MH9lvpJReXwXhWeFMqAfwLggy1lrK+1oD tScw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746508578; x=1747113378; 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=DxN2xt1kZKeXI3lAcxc6uYyjHPG48y1wN3B/daO0PK4=; b=uCHrz8AyjPRcQfJuhWSHfXcsIJGpsFEH9FnnNqObAJouONQrsqHoFaxY/xBS4hUEi7 zhODfZL369KD/SLY4gjI0AkcXMGifwKfTFDFvagFyOcdMtpWLe7zkZQKDGUXo16m/12a JFI5YyEku1NiqQvQSDzbcv1Ng+wadTVhX4PPK57wBsJqEuJs+zkFWSZ9naD5cMnMuwOz OXTxmeHOBCnfy4LWeCnpg/mpWgzOATe6G7O6tlNrsCYV9kkfvzqRG0Dv6oFrIhjnk4v+ MCFmPqEJA+i+DO09DLbyzb9dVvZT7/AC/Tmw4yjP93ceG5JiX1orlpf63K85xzx9D8Ho ToNw== X-Forwarded-Encrypted: i=1; AJvYcCXWWMf4aL0IX4NG9HjPK9MVssmD2GLNYgOuitRCdBuNpvEy31+suW9fuswlSEEq++567q635WAiikfo1kqa@lists.postgresql.org X-Gm-Message-State: AOJu0Yyq9Lxu2DvNMf2D1dD0ee+zu6T/WrAkV/Lko4IRIwFslHkVvJPv /jfA68ZqajhhYr4ee+vO16hjXeXNMOVgBXVFfkukrvkBFOpWQtGiYpl2W2W/bj+bCsYCaP0Ayv0 aSr0/TFVha3RPJQkSPCSeHOP7Srg= X-Gm-Gg: ASbGncsR0JKopZ5yvealnBYIkI9KE2qeVDhRs0ZR1uae2UCdG6Kz0d5sxH/ToKqc3Wz 5Ep4t4X0DB/ai+RScY3P5HsYPOl8W1fIucoBv7h3yBkSdGmLqoQuYPaHTfbKLfBXLc/pkjsdnJT 0l67Wmcf0FGI0GZ5ABkbRh X-Google-Smtp-Source: AGHT+IFqwjajxPtbKSB2ugkd57W0wkV3ni8dORnOZl/2uTRG8iNS6KxHxumWiwDtX52GqQM3JVMrZgAVF/CyrAzK2yU= X-Received: by 2002:a05:6902:124b:b0:e6b:7af6:5681 with SMTP id 3f1490d57ef6-e757d364942mr11914228276.35.1746508578147; Mon, 05 May 2025 22:16:18 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Daniil Davydov <3danissimo@gmail.com> Date: Tue, 6 May 2025 12:16:06 +0700 X-Gm-Features: ATxdqUG3Et0n3kInrI7_vN0ZarqzyV3yu_4sP8P9eMJEzp6O7_oYDi9tv2mLDKA Message-ID: Subject: Re: POC: Parallel processing of indexes in autovacuum To: Sami Imseih Cc: Masahiko Sawada , 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, May 6, 2025 at 7:21=E2=80=AFAM Sami Imseih wr= ote: > > Perhaps we should only provide a reloption, therefore only tables specifi= ed > by the user via the reloption can be autovacuumed in parallel? =D0=90fter your comments (earlier in this thread) I decided to do just that. For now we have reloption, so the user can decide which tables are "important" for parallel index vacuuming. We also set lower bounds (hardcoded) on the number of indexes and the number of dead tuples. For example, there is no need to use a parallel vacuum if the table has only one index. The situation is more complicated with the number of dead tuples - we need tests that would show the optimal minimum value. This issue is still being worked out. > This gives a targeted approach. Of course if multiple of these allowed ta= bles > are to be autovacuumed at the same time, some may not get all the workers= , > But that=E2=80=99s not different from if you are to manually vacuum in pa= rallel the tables > at the same time. I fully agree. Recently v2 patch has been supplemented with a new feature [1] - multiple tables in a cluster can be processed in parallel during autovacuum. And of course, not every a/v worker can get enough supportive processes, but this is considered normal behavior. Maximum number of supportive workers is limited by the GUC variable. [1] I guess that I'll send it within the v3 patch, that will also contain logic that was discussed in the letter above - using bgworkers instead of additional a/v workers. BTW, what do you think about this idea? -- Best regards, Daniil Davydov