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.96) (envelope-from ) id 1wAuGB-000YaU-0c for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Apr 2026 18:37:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wAuG9-007Inp-0H for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Apr 2026 18:37:45 +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.96) (envelope-from ) id 1wAuG8-007Inh-29 for pgsql-hackers@lists.postgresql.org; Thu, 09 Apr 2026 18:37:45 +0000 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wAuG7-00000000Ct1-0oUB for pgsql-hackers@lists.postgresql.org; Thu, 09 Apr 2026 18:37:44 +0000 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-35d8e548a05so1273890a91.1 for ; Thu, 09 Apr 2026 11:37:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775759863; cv=none; d=google.com; s=arc-20240605; b=BLhP8lXi6JP4cnAoQIfsrPTgwov0+4YqNTBZZTZyP/zPCsPZcCy1E0vv8exV5HUAO/ 1ATU0Ftz4yFOFCg17XpKjoBq1c+KfI+LHmlQnqWLC6yZjXgb52NXgmO6HaUJo0QepSiQ EtsAbeN+LtRFzV/oEdlG2BfjLMnVp8fEjhZDLUPQ9kEFO3maRrTIzJKI3Q04jzfI0RiW 05/VlmPiMO7rLw9qeJsw1kX5M6w+Rn9YwFmqI+y3+YVDYSSHmojaQw8V7JxgHeuyM6F1 KzMBRePm116dWmKDlRD4FPMBImDXVoAwxgmkWMKH1HsUqXkqJMU2eUpVN6GXSEx8vzGO 9oAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=pT0rZc90cfmDJi1yy8KG8+ig/H9fYBmQjYRvBFnZ5bE=; fh=Dsr6JZ5yeSHmu4vhcMiGvgHgfeTe6zQ8SbykHo7i+Lo=; b=XrPcGYMITGqlCWGKCSxsCGmflaqm3HsgD95sAA0uEbx7uq0DqohtZF2uNXPWOOTqu3 JY+4mD6Xzjaqk4ZlGrtkvpy1mATf1cjGd3Bf3jfyVftFCdCg6e/Y+ov/3cOxSsRLTO9S HNWZPUXWExNvmY/9qNONUGzilTuh+cKwG5jS/fdS6+lCu2r0EL6B27lhLgdZWlZVuNYM AS99vPN+lmBYqt8mHCDfJN7oOAdJETcjuJHZ5tpsZ3NO5/ajefV25hmBGxaF2uUnlnt+ kos3sF3Ki2Buhh6C+NKmL+h+/I7VOR2pfU3R0E14X23kroMXTTqu5jAjgCmVu3P4yoP9 OyUQ==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775759863; x=1776364663; 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=pT0rZc90cfmDJi1yy8KG8+ig/H9fYBmQjYRvBFnZ5bE=; b=cth1l2MORQaesm2f8cSOxM9KsU/6RtldHIjDMtP/XW56IlyK7EUvVnX4NCejPW/uIy GBaYIjk4VYcumbv+7+V8pTiBwKsfPQpjc05eczlFq9l8QWc+KTMLBBsHizc9Zvx3Pj/0 OPnrUWIE6PhWlUS2gkchsHpIiZfgbdXogvw6lMVJ78O4UoysGKeXKDCnUuyoC80vW6RL QKjMegIc6mieUly5oDfgoArpmiRn7Eqysib56EZK3FgtSN47qL9x65CihcmRrbldlKpD 3vG44uCAG/v4j1R6Ubc2g13VN7H241NU2AJHnFYXvDBEFm2PwquMkmvNIx50uddPd/3W 9R/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775759863; x=1776364663; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=pT0rZc90cfmDJi1yy8KG8+ig/H9fYBmQjYRvBFnZ5bE=; b=SdDKehN4SAOn3klKnR4sJLbUNhvQEuWIgKEitI8Og5BQWTHulSStOHZ90NzPs3+24b dkklsMfiteXb3wLqDmuGNUo8rGInBRY9aK+0hrpGMUAVryXTvymXIiqYhIzxNeqKRIBg AUz7oesr+ba3rSsvvUshDV1aqp71QduMzUsbf3/8VGwXKanLh24ZiqsTW9nzAvLehq0V VKeth+qWOA4IQ4NohdBRUK692kqyc4sPqa/K4L9wm1SbBseL+TYt3zrYYh2eYslp5tTz YRiGPFVTow63jgcGY6u13TbzqMjDmSctPQLko66fiY0WA+aPyQiWuOUGLa11d0yEUBVP KRrw== X-Forwarded-Encrypted: i=1; AJvYcCX7Kb4pbYs2vJYN6HEjh7YQX1FonNgD/9JPGvn+Tz6C2USuqHlC6fR1++mlOibfMfxkEIqBSqtLC8vRUk2x@lists.postgresql.org X-Gm-Message-State: AOJu0YwJzCUNY17y0J6YY+apBHqdyZlzDbFJWAkdBl7IwwxYFL3Chrxv V+7Lno1JDUOe4gDKunReGPMwf5tNSwRvqo3zcAUVMpCjR3XQSxdJT88U+Udm1ATSYTi3YePfcR9 xm9S4bl/4bQc/6juqjjZVof7NtkoJmBw= X-Gm-Gg: AeBDiesEE2zk9RJc7PEAuQfvnG/krfmhaxvPoifv66/5oY10KIgcWtpsdiQufhWEz+n rb0cNMEsAvpGPsptcoppsYvLnLOnYur0KeBVuVU85HmdM1x0niRel5Gn7E8C9wFkUr53IyFDx2C BPz8vhhK1I9fffUal1PBvUZEsk4jYSVE99vMtXGU80LoDusw0Zk60zdjm8HZPKCEPQo56Iyupm0 hXItpfrV5oNaMFBxtQo6453G1yrTC/TX0pw082dyNlchlmjctBsaUGNGtEaAnQOmARl726bov8/ UQ1Z0w== X-Received: by 2002:a17:90b:3d48:b0:35d:93ff:284f with SMTP id 98e67ed59e1d1-35e4282bdabmr168139a91.15.1775759862652; Thu, 09 Apr 2026 11:37:42 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Masahiko Sawada Date: Thu, 9 Apr 2026 11:37:04 -0700 X-Gm-Features: AQROBzBGlBv_GgJ10uXRaZJLwY5M2NAdEYOa-aKCbRG7eRkKeltRgJ9XnVplzXc Message-ID: Subject: Re: POC: Parallel processing of indexes in autovacuum To: Daniil Davydov <3danissimo@gmail.com> Cc: Alexander Korotkov , SATYANARAYANA NARLAPURAM , Bharath Rupireddy , 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, Apr 7, 2026 at 6:32=E2=80=AFAM Daniil Davydov <3danissimo@gmail.com= > wrote: > > Hi, > > On Tue, Apr 7, 2026 at 10:49=E2=80=AFAM Masahiko Sawada wrote: > > > > > > > > > > While some autovacuum parameters do override GUCs, those are typica= lly > > > > local to the process (like cost delay). Parallel workers, however, = are > > > > a shared system-wide resource. In a multi-tenant environment, allow= ing > > > > a single table's reloption to bypass the > > > > autovacuum_max_parallel_workers =3D 0 limit could lead to unexpecte= d > > > > exhaustion of the worker pool. > > > > > > Will this exhaustion really be unexpected? If we describe such an abi= lity in > > > the documentation, and the user uses it, then everything is fair. Eve= n if > > > administrator forgets that he enabled av_parallel_workers reloption s= omewhere, > > > then he can : > > > > How can DBAs prevent parallel workers from being exhaustly used if > > users set a high value to the reloption? > > > > Only manual control. Since DBA increased reloption manually, it is OK to = ask > him to manually decrease it. In multi-tenant environments, the roles of table owners and DBAs are often separated. Tenants can freely set reloptions via ALTER TABLE, but a DBA cannot easily revert those settings on user-owned tables. Even if a DBA tries to use ALTER TABLE to fix a misconfigured reloption, it would cancel any currently running autovacuum on that table. Furthermore, if the table is undergoing an anti-wraparound vacuum, the ALTER TABLE command itself will be blocked, making it impossible to resolve a resource crisis quickly. If a single tenant could exhaust the entire parallel worker pool by setting a high reloption value, the DBA would have no effective way to prevent or mitigate it under an override model. While I understand the use case for enabling parallel vacuum only on specific tables, this is already achievable under the cap model (by setting a global GUC > 0 and using the reloption to disable it on others), even if the initial configuration is more tedious. Also, I'm concerned that the override behavior would be inconsistent with other parallel-query-related features. While some autovacuum reloptions (like autovacuum_vacuum_scale_factor) do override GUCs, those parameters only affect the local behavior of that specific process and do not impact shared system-wide resources. In contrast, autovacuum_max_parallel_workers takes workers from the max_parallel_workers pool. Allowing a single table to monopolize this shared pool by bypassing the GUC cap creates a significant risk that cannot be easily managed. While this isn't exclusively about multi-tenancy, I think that we cannot simply introduce a behavior that creates such a high risk for system-wide resource exhaustion. > > > > 1) > > > Check the logfile (if log level is not too high) searching for logs l= ike > > > "parallel workers: index vacuum: N planned, N launched in total". > > > 2) > > > Run a query that selects all tables which have av_parallel_workers > = 0. > > > > Does that mean DBAs would need to run these queries periodically? > > Not really. I say that even if DBA has lost control on the parallel a/v > workers, it has an ability to find these bottlenecks. > > > I don't think that in a multi-tenant environment, DBAs can (or should) > > execute ALTER TABLE on user-owned tables just to fix resource issues. > > > > Well, the people I talked to had a different opinion which is based on cl= ients > feedback : what is acceptable and what is not. I don't think that we can > convince each other, so let it be as it is :) > > But if you don't mind continuing to discuss this topic (perhaps with the > involvement of other people), I would love to create a new thread for it. Okay. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com