Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jxW01-0002Dd-Iz for pgsql-general@arkaria.postgresql.org; Mon, 20 Jul 2020 13:38:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jxW00-0000tY-J7 for pgsql-general@arkaria.postgresql.org; Mon, 20 Jul 2020 13:38:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jxVzh-0005LV-J0 for pgsql-general@lists.postgresql.org; Mon, 20 Jul 2020 13:38:13 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jxVzf-0000cH-LJ for pgsql-general@postgresql.org; Mon, 20 Jul 2020 13:38:12 +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 06KDcAZn401421; Mon, 20 Jul 2020 09:38:10 -0400 From: Tom Lane To: Durumdara cc: Postgres General Subject: Re: PGBench on Windows - connections are subprocesses? In-reply-to: References: Comments: In-reply-to Durumdara message dated "Mon, 20 Jul 2020 15:20:54 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <401419.1595252290.1@sss.pgh.pa.us> Date: Mon, 20 Jul 2020 09:38:10 -0400 Message-ID: <401420.1595252290@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Durumdara writes: > But the number of threads option (j I think) confused me. At first I > thought the total connection number is simply the multiplication of c and j > (subconnections). > As I saw this is untrue. > So I don't know how this utility works really in the background. There are -j threads in the pgbench process, and -c connections to the server (hence -c backend processes on the server side). Each of the pgbench threads is responsible for sending queries to a subset of the connections. Setting -j more than -c is useless (I forget if it's actually an error). If you set -j to, say, half of -c then each thread has exactly two connections to manage. If -j is too small compared to -c then pgbench itself tends to become the bottleneck. regards, tom lane