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 1t0FX5-00AGiV-Rj for pgsql-general@arkaria.postgresql.org; Mon, 14 Oct 2024 07:30: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 1t0FX3-00B6Ri-RY for pgsql-general@arkaria.postgresql.org; Mon, 14 Oct 2024 07:30:22 +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 1t0FX3-00B6RZ-DW for pgsql-general@lists.postgresql.org; Mon, 14 Oct 2024 07:30:21 +0000 Received: from shakotay.alphanet.ch ([46.140.72.222]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t0FX0-000nTp-VS for pgsql-general@lists.postgresql.org; Mon, 14 Oct 2024 07:30:20 +0000 Received: by shakotay.alphanet.ch (Postfix, from userid 1022) id 5AD841241834; Mon, 14 Oct 2024 09:30:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alphanet.ch; s=mail; t=1728891015; bh=lde1UDKGfERGDwlRegNimleCZT16/n4/OyFgVDwlJlI=; h=Date:From:To:Subject:References:In-Reply-To:From; b=SmiuKKRLHjmUlCt8Vf37EqsHiUp5xjU5iyb2QGcPVoRJOx/JDqIypD8UcoFmmFIqy qylcbZTSrlF91hJg65hLcrY1/5RMJSc6mCnxwA2Spu89J8DStbjE+2xQu2HI/bb6J+ rmdLMZN9oJJoo8lVh34K0FlFuPIIkJ6VFfEQfrcsBsPUNfowAGgdxTFs0VIoO3TpxN aWwMOCcBcO4wpa8sphx8XdTTWZNDyDmCDXaGihxl8sEneMXNwNfTthPPENoTMyeN/j hNudrMfpLsyJn24RF4u90WLkCTZXAsYcnRn7/8+f0KRov+n8NABfaDo6NH1OWHZvx7 BIynl9ywPLaCA== Received: from reliant.alphanet.ch (reliant.alphanet.ch [192.168.1.30]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shakotay.alphanet.ch (Postfix) with ESMTPS id DD0EC1241353 for ; Mon, 14 Oct 2024 09:30:07 +0200 (CEST) Received: by reliant.alphanet.ch (Postfix, from userid 1000) id C310D76CA4F; Mon, 14 Oct 2024 09:30:07 +0200 (CEST) Date: Mon, 14 Oct 2024 09:30:07 +0200 From: Marc SCHAEFER To: pgsql-general@lists.postgresql.org Subject: Re: Naive question about multithreading/multicore Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, On Sun, Oct 13, 2024 at 08:16:04AM +1300, Thomas Munro wrote: > > template1=> SELECT COUNT(*) FROM pg_class a, pg_class b, pg_class c; > > > > I see only one 100% CPU PostgreSQL process. > > If you set set min_parallel_table_scan_size = 0 then it uses Without it, it uses one CPU and takes about 8.5 s (count is 57512456). With it, it is indeed parallel (multiple CPU used) and it takes about 6s. As this is on a machine with slow disks, it is perfectly ok, I just wanted to see the CPU parallelism in action. Thank you!