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 1uZA80-00GuJ3-Fh for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Jul 2025 15:21:04 +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 1uZA7x-009OLp-7e for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Jul 2025 15:21:01 +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 1uZA7w-009OLI-Nn for pgsql-hackers@lists.postgresql.org; Tue, 08 Jul 2025 15:21:01 +0000 Received: from mail-qk1-x730.google.com ([2607:f8b0:4864:20::730]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uZA7v-006Ez9-1z for pgsql-hackers@lists.postgresql.org; Tue, 08 Jul 2025 15:21:00 +0000 Received: by mail-qk1-x730.google.com with SMTP id af79cd13be357-7db39af4d22so602685a.0 for ; Tue, 08 Jul 2025 08:20:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751988058; x=1752592858; darn=lists.postgresql.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=o0L4XT800mY5XJ5nO/YhUV9BiRrkfTVksSZ/jpcuGq4=; b=gqM7TYVbySvZpJBW2vcrASZkfbiyYoDbL8rAZmEZbWxDKhWkwpP7Y8pUaFuyk/YS5+ IMAg35w1h+/D2qcJC8L5z4FI8Vbw4lsUVcEd5V7xE1wettkk84su/tXhGcNPi708dTj3 TETdLJ3QA7YMd3JyWF2KEbtzomeMdH6k96h5F5FXZRTr81+1Wcou+j6VNfoAe+ucx4sM EHCh0EpW2VGCVHzbhGdcQBAmeUZgj07kiuiW+Bpsb5MwfUGzQZ+4hUKYSICuN7/4ICI+ 4ROJiGONz2/rReGdHHkuSplhcwPj9ayTFjTbvsTRBEDU++tUV0ACdXcw4W3dooR4s6Qc iwdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751988058; x=1752592858; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=o0L4XT800mY5XJ5nO/YhUV9BiRrkfTVksSZ/jpcuGq4=; b=MWFXnHLF8bchiq7lF66UFHph34y5j5FLDKgYpQ+eV1qT2A32fM/zyeu09wYy/DcBQq aVp0+lUagKzJUhuNx3z6UNbo/0rrE82fWi8wfHnQS/4ZT+CbqA8K+bIHX4VUiw4hWD+a D2VnrGSRXbazmDdS/w8z0Dh8bMroWJaM1fXoL+ZEXfMPc1jrvWjejLr/T4gE9NuWqNmm adNJVpLOHsUOI8cuwKTEbqhpOP6vBXT54dYFONQukQcPuCN3tqPi0tQHAtPqAoV9IZmK B9ZzkOrwEO4AAHrDYCkrb4Qql1Btg695qZIf1tKJpJzEiU/XRXDMAEo0IZMU5SQzZfTq VJTA== X-Forwarded-Encrypted: i=1; AJvYcCUr+8c+ebVZ5qJ+9TiZL8zULpLEsEfOdMv3W7TxCT41LOzyfbb7T76UbNE4eQCFqwwz5Q6fDwETyWlfgbnR@lists.postgresql.org X-Gm-Message-State: AOJu0Yz7KirvvH9Q3Q0SWyOSJPCm3Xkv6u2Jzia/hfxSd01jZMYBrCn5 IeH9FGQ2AVnHTh9abO/eZPFZSBwohqmK3Yij9VwhMXRfST9QYMAZVAg2 X-Gm-Gg: ASbGnct5JEmN6j6YX6avCLDBuwuTT/VB63rQb05Hb7aSqE0RzMdEIaaVQLzxA2CgF2a KYl/mZ1qb1j3xDqDdyZPc0F1ZhEDJbqp3OBL3pI3Twu8zWaPSztGcYresAfEF3dAKFnvfEccPDP ea7qm90m4xn8qXr34RQZWeZX1fu9Zalcsv4GG2N5R0XFhOw0ZbChF7kW/xO033GostNoeCJ7qqC b1TzV9syO3XGCZO48eedA2p+7LuG/8tzorTVDeYiSkekjFCC0rmoTx7DKkZt2b5tn01ULo88Zee PqHNRM4N2JIw6SrNentgFVvRNTRe/1OOyAR/a2XYm0CHpS1OEt+6uog3pH11s5U5p7zUCDyjR1Q DmNk7ZD4jkA== X-Google-Smtp-Source: AGHT+IFq9pbq/ZkZlmo3o5RtcnhhwGVS/zMlfoy4Ci5LqhVMqQmpzbeFDx+RlSw38ZBz3SaTHtaugw== X-Received: by 2002:a05:620a:3705:b0:7d2:2822:3f79 with SMTP id af79cd13be357-7d5df0efa00mr2298198285a.13.1751988058324; Tue, 08 Jul 2025 08:20:58 -0700 (PDT) Received: from localhost ([2804:14d:328a:a59c:e579:cd62:6624:d347]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7d5dbe8f861sm792844085a.86.2025.07.08.08.20.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Jul 2025 08:20:57 -0700 (PDT) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 08 Jul 2025 12:20:54 -0300 Message-Id: Cc: "Masahiko Sawada" , "Sami Imseih" , "Maxim Orlov" , "Postgres hackers" Subject: Re: POC: Parallel processing of indexes in autovacuum From: "Matheus Alcantara" To: "Daniil Davydov" <3danissimo@gmail.com> X-Mailer: aerc 0.20.1 References: In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun Jul 6, 2025 at 5:00 AM -03, Daniil Davydov wrote: >> The "autovacuum_max_parallel_workers" declared on guc_tables.c mention >> that is capped by "max_worker_process": >> + { >> + {"autovacuum_max_parallel_workers", PGC_SIGHUP, VACUUM_A= UTOVACUUM, >> + gettext_noop("Maximum number of parallel autovac= uum workers, that can be taken from bgworkers pool."), >> + gettext_noop("This parameter is capped by \"max_= worker_processes\" (not by \"autovacuum_max_workers\"!)."), >> + }, >> + &autovacuum_max_parallel_workers, >> + 0, 0, MAX_BACKENDS, >> + check_autovacuum_max_parallel_workers, NULL, NULL >> + }, >> >> IIUC the code, it cap by "max_worker_process", but Masahiko has mention >> on [1] that it should be capped by max_parallel_workers. > To be honest, I don't think that this parameter should be explicitly > capped at all. > Other parallel operations (for example parallel index build or VACUUM > PARALLEL) just request as many workers as they want without looking at > 'max_parallel_workers'. > And they will not complain, if not all requested workers were launched. > > Thus, even if 'autovacuum_max_parallel_workers' is higher than > 'max_parallel_workers' the worst that can happen is that not all > requested workers will be running (which is a common situation). > Users can handle it by looking for logs like "planned vs. launched" > and increasing 'max_parallel_workers' if needed. > > On the other hand, obviously it doesn't make sense to request more > workers than 'max_worker_processes' (moreover, this parameter cannot > be changed as easily as 'max_parallel_workers'). > > I will keep the 'max_worker_processes' limit, so autovacuum will not > waste time initializing a parallel context if there is no chance that > the request will succeed. > But it's worth remembering that actually the > 'autovacuum_max_parallel_workers' parameter will always be implicitly > capped by 'max_parallel_workers'. > > What do you think about it? >=20 It make sense to me. The main benefit that I see on capping autovacuum_max_parallel_workers parameter is that users will see "invalid value for parameter "autovacuum_max_parallel_workers"" error on logs instead of need to search for "planned vs. launched", which can be trick if log_min_messages is not set to at least the info level (the default warning level will not show this log message). If we decide to not cap this on code I think that at least would be good to mention this on documentation. >> >> I've made some tests and I can confirm that is working correctly for >> what I can see. I think that would be to start include the documentation >> changes, what do you think? >> > > It sounds tempting :) > But perhaps first we should agree on the limitation of the > 'autovacuum_max_parallel_workers' parameter. > Agree > Please, see v6 patches : > 1) Fixed typos in autovacuum.c and postgresql.conf.sample > 2) Removed unused macro 'RelationGetParallelAutovacuumWorkers' > Thanks! -- Matheus Alcantara