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 1sxbp2-00BBq0-Jw for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Oct 2024 00:42:00 +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 1sxbp0-003qdY-B2 for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Oct 2024 00:41:58 +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 1sxboz-003qdO-Sr for pgsql-hackers@lists.postgresql.org; Mon, 07 Oct 2024 00:41:58 +0000 Received: from fhigh-a2-smtp.messagingengine.com ([103.168.172.153]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sxbox-002s8T-Bd for pgsql-hackers@lists.postgresql.org; Mon, 07 Oct 2024 00:41:56 +0000 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id 7061911400FA; Sun, 6 Oct 2024 20:41:54 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Sun, 06 Oct 2024 20:41:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728261714; x=1728348114; bh=fUC6zeMLbV RyJEkIeHzpnUri3eXCRy4C7voeRpJZU0E=; b=k5E3mHaDcfXup8uzciHkLZLNke oJfB5qYcC6sJTnEgg0pj6ShywKrHDyo6qgBEM0VsyRKc/Cy+WBiQkiJAACRQ4LXC OBdU535uQfFRI5NERjMD7EGPGFPgsZzHwRLzjGgRtMDXY3G6y/nf9XdUzd1hV0c9 MCS5fHOGaz8j+CsXjxzTEBZUUiY+m/+HbmRhatJzo71PP7jcecMhCALh87t4x8dx UyreZWRbuXnDH52o+/A63axedYIDiSOZHC2O5t/rdizwe+u+/2th+jWYpMpKiGLK uXUKtixFmBfALSvsM4esKVWbyjBO3LFEpIjUbIfo5iSrf/AGv4ZYtzf1yG9Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728261714; x=1728348114; bh=fUC6zeMLbVRyJEkIeHzpnUri3eXC Ry4C7voeRpJZU0E=; b=k6oLwMuE1L3zAbaMvje1lxa31STwD5Jkx7S+KmJgrf0p fKw5e0K4zHA7gyU4Cy3WXPDotCuhYD4wR9IrqDddaP7y8BBAHZ7HKQqkjpGZcXU7 1jLY4MMGwFNe7lshOKxKkXfPtleIvkbTy5StncSAgGNguSuSOXJ4sCR82YnZbzfC AnekMjshaMb6rnup48oX8L+GGIFyHLJEoaVaJJ4gJWa18mlNq5ShCeCaG7SphdGz BfjcEfWbxSliQDCYsj4SzR+4Dc2QwOm+dwigEjTYRGd/yqNgVE3pJ+QT6oMG01Np Ki0EPHc/KNri57vKgxAUGpVbogk6S6w8MtsPiiCfDQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvddvkedgfeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnegfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhf gggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruc eomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteel ieefudffhffhtdetleeggeegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhes phgrqhhuihgvrhdrgiihiidpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouh htpdhrtghpthhtoheprgdrrhihsggrkhhinhgrsehpohhsthhgrhgvshhprhhordhruhdp rhgtphhtthhopehguhhilhhlrghumhgvsehlvghlrghrghgvrdhinhhfohdprhgtphhtth hopegsvghrthhrrghnuggurhhouhhvohhtrdhpghesghhmrghilhdrtghomhdprhgtphht thhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdroh hrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 6 Oct 2024 20:41:52 -0400 (EDT) Date: Mon, 7 Oct 2024 09:41:36 +0900 From: Michael Paquier To: Alena Rybakina Cc: Guillaume Lelarge , Bertrand Drouvot , PostgreSQL Hackers Subject: Re: Add parallel columns for seq scan and index scan on pg_stat_all_tables and _indexes Message-ID: References: <09424f5e-4ddf-4830-a21f-161e0427f112@postgrespro.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="IimKSzunjYZeidT4" Content-Disposition: inline In-Reply-To: <09424f5e-4ddf-4830-a21f-161e0427f112@postgrespro.ru> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --IimKSzunjYZeidT4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Oct 07, 2024 at 12:43:18AM +0300, Alena Rybakina wrote: > Maybe I'm not aware of the whole context of the thread and maybe my > questions will seem a bit stupid, but honestly > it's not entirely clear to me how this statistics will help to adjust the > number of parallel workers. > We may have situations when during overestimation of the cardinality during > query optimization a several number of parallel workers were unjustifiably > generated and vice versa - > due to a high workload only a few number of workers were generated. > How do we identify such cases so as not to increase or decrease the number > of parallel workers when it is not necessary? Well. For spiky workloads, only these numbers are not going to help. If you can map them with the number of times a query related to these tables has been called, something that pg_stat_statements would be able to show more information about. FWIW, I have doubts that these numbers attached to this portion of the system are always useful. For OLTP workloads, parallel workers would unlikely be spawned because even with JOINs we won't work with a high number of tuples that require them. This could be interested with analytics, however complex query sequences mean that we'd still need to look at all the plans involving the relations where there is an unbalance of planned/spawned workers, because these can usually involve quite a few gather nodes. At the end of the day, it seems to me that we would still need data that involves statements to track down specific plans that are starving. If your application does not have that many statements, looking at individial plans is OK, but if you have hundreds of them to dig into, this is time-consuming and stats at table/index level don't offer data in terms of stuff that stands out and needs adjustments. And this is without the argument of bloating more the stats entries for each table, even if it matters less now that these stats are in shmem lately. -- Michael --IimKSzunjYZeidT4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmcDLkAACgkQnvQgOdby QH0rYQ//cs1aL3SyQQw17Pa9N6TuGNNnGLqMXhRoJmOtsdGnUaw6wdaKYJ7gIjpt M8j6OahbyNAbClYvEyoCa6wyE3ogGVX+AyrckcbUeYecDBXVZBxAYg+wxfF+XLnr k4sFbVezJCd5pe9V/RTKMXzjYprQbVLjlayhSN9Y0lElhfB2bAt5XwSpm4HRnxNV mxuGveQ1wQ9lqSkgxf/vxV1aiHST4NK7WIygCC2Yz6kc5vDNYbWXZN2MI1zTMmyl +gtcRzqGK7yv7L8weBG6OqQlcrspsPAOSXYiA/x4RTgji3CNcs5fZQf8zP5SVEqn EMJiSXtgUSDyFjRyX7ZzbHS1P/uB7JaUJlDn3IF6YRcyZ6GOBv9+o3O0D2ek2Xue +7NAbzmW7awpB1A0GTaI5LeQTjxHLC0R+mR9weTBdFoK4FjIX4QkfJ3UXDv1qDEd 3DKqdU92kQHrznJYLtOJuPdBgu4T9o8DlFAwLkVMj3/szlREfKMQ1OkzclA94JZr beP22uTi5U5uk+Ff30r08iWF+EiCaOdg+jCF1W10s/3Sfm9c9cbqlsW3YviQSv15 huuzz6OGUYghApVt70Q2PQc6eB1DF8usjv62IMSaH1CZs3aOeXiYOJygso3CfKQp Ab+r887/ucgnCAuuHh2SqHZpNl+lGCeKWRJoKI6cJww0Vj/n7Cw= =zy7d -----END PGP SIGNATURE----- --IimKSzunjYZeidT4--