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 1ubOK9-000GSV-7o for pgsql-general@arkaria.postgresql.org; Mon, 14 Jul 2025 18:54: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 1ubOK6-00BXzy-1f for pgsql-general@arkaria.postgresql.org; Mon, 14 Jul 2025 18:54:46 +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 1ubOK5-00BXzq-NE for pgsql-general@lists.postgresql.org; Mon, 14 Jul 2025 18:54:46 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ubOK4-007gpV-0Q for pgsql-general@lists.postgresql.org; Mon, 14 Jul 2025 18:54:46 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 56EIsgxK710284; Mon, 14 Jul 2025 14:54:42 -0400 From: Tom Lane To: Greg Hennessy cc: "Weck, Luis" , "pgsql-general@lists.postgresql.org" Subject: Re: optimizing number of workers In-reply-to: References: Comments: In-reply-to Greg Hennessy message dated "Mon, 14 Jul 2025 14:25:19 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <710282.1752519282.1@sss.pgh.pa.us> Date: Mon, 14 Jul 2025 14:54:42 -0400 Message-ID: <710283.1752519282@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Greg Hennessy writes: >> Postgres has chosen to use only a small fraction of the CPU's I have on >> my machine. Given the query returns an answer in about 8 seconds, it may be >> that Postgresql has allocated the proper number of works. But if I wanted >> to try to tweak some config parameters to see if using more workers >> would give me an answer faster, I don't seem to see any obvious knobs >> to turn. Are there parameters that I can adjust to see if I can increase >> throughput? Would adjusting parallel_setup_cost or parallel_tuple_cost >> likely to be of help? See the bit about * Select the number of workers based on the log of the size of * the relation. This probably needs to be a good deal more * sophisticated, but we need something here for now. Note that in compute_parallel_worker(). You can move things at the margins by changing min_parallel_table_scan_size, but that logarithmic behavior will constrain the number of workers pretty quickly. You'd have to change that code to assign a whole bunch of workers to one scan. (No, I don't know why it's done like that. There might be related discussion in our archives, but finding it could be difficult.) regards, tom lane