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 1tDWNq-001HTb-TU for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Nov 2024 22:07:43 +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 1tDWNp-00HTVO-61 for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Nov 2024 22:07:41 +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 1tDWNn-00HTVC-Md for pgsql-hackers@lists.postgresql.org; Tue, 19 Nov 2024 22:07:40 +0000 Received: from fhigh-a1-smtp.messagingengine.com ([103.168.172.152]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tDWNk-002lTl-Nc for pgsql-hackers@postgresql.org; Tue, 19 Nov 2024 22:07:38 +0000 Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id 632961140243; Tue, 19 Nov 2024 17:07:34 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Tue, 19 Nov 2024 17:07:34 -0500 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=fm3; t=1732054054; x=1732140454; bh=hB6Akqk+WF sKyfU7/AEXo2iZjkTQMBS4hpgOIV1WpQo=; b=CUqOwGZQI9dNYcYkO1yLjBHVWg 5ztF3lrWb+qfyYQlfQhpYrsputupiYqfuUYuJmI7OfF7nkRxzQ38HqWj4sS5XOrV X5k/hfFx6+ZmFcftG3kZb81rIOBSXNXYstrp00rsRffUPmJkDv1IXXOpcbaaeEkN 5MugQCud+E4B5kvJoOJtF/ECYB43A40/mMtyDoapNAkaVZZC4q3sk7IorhU1R32i H6OH6fy0DLtoHA4tuzeKkxvJBfY7vhmw0jDxmE6Q1x614POFcNp2FiuMm6ciw+im FTLl5Fnh/LiFkZWPhO7PabAn3Tkrs1GYfJaCjhOPLlhB8jwj/GGcM/qaZrjg== 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-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1732054054; x=1732140454; bh=hB6Akqk+WFsKyfU7/AEXo2iZjkTQMBS4hpg OIV1WpQo=; b=QO8OnJgcOGrnEE2jg7KcThZkeRuTYSgz3f7UsiN585S1zjcQUfl mrgN40r0XANjPY0ugKL5Pc8o/vxFfa2yuFBJ4/Bl+GFpD9nm+giJbcsHsoNse+jg SYPU0mnrOPaBWNl+DbWMHgKoRdF9Ka768TDI8Mr1HmW7lbRAhgQm+S6y61AO267z +SqRgJic67dMuxUheBnh9x7s5vsTQuK+pwZ+cIJKCoN7kv0GyNqDLNul5HHznV5x U/gChLVSKIqSn/0h8uY3lrtJp7zeNUlx/we1u1NJ4t1Zoi80S1Q6jJSP6LuuFJjx bNEr+uGfVYAP4n8UNxhdFk/IA6rmMXLDLLg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrfedvgdduheehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnegfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhf gggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruc eomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteel ieefudffhffhtdetleeggeegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhes phgrqhhuihgvrhdrgiihiidpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouh htpdhrtghpthhtohephhhtrghmfhhiughssehgmhgrihhlrdgtohhmpdhrtghpthhtohep giegmhhmmheshigrnhguvgigqdhtvggrmhdrrhhupdhrtghpthhtohepihhlhigrrdgvvh guohhkihhmohhvsehtrghnthhorhhlrggsshdrtghomhdprhgtphhtthhopehpghhsqhhl qdhhrggtkhgvrhhssehpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 19 Nov 2024 17:07:31 -0500 (EST) Date: Wed, 20 Nov 2024 07:07:16 +0900 From: Michael Paquier To: Greg Sabino Mullane Cc: "Andrey M. Borodin" , Ilia Evdokimov , pgsql-hackers Subject: Re: Sample rate added to pg_stat_statements Message-ID: References: <6707FCA9-FD1A-4609-A1A6-142456C14E0C@yandex-team.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="okv+DDOfJM6YhplI" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --okv+DDOfJM6YhplI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 19, 2024 at 09:39:21AM -0500, Greg Sabino Mullane wrote: > Oh, and a +1 in general to the patch, OP, although it would also be nice = to > start finding the bottlenecks that cause such performance issues. FWIW, I'm not eager to integrate this proposal without looking at this exact argument in depth. One piece of it would be to see how much of such "bottlenecks" we would be able to get rid of by integrating pg_stat_statements into=20 the central pgstats with the custom APIs, without pushing the module into core. This means that we would combine the existing hash of pgss to shrink to 8 bytes for objid rather than 13 bytes now as the current code relies on (toplevel, userid, queryid) for the entry lookup (entry removal is sniped with these three values as well, or dshash seq scans). The odds of conflicts still still play in our favor even if we have a few million entries, or even ten times that. This would also get rid of the pgss text file for the queries, which is a source of one of the bottlenecks, as we could just store query strings upper-bounded based on a postmaster GUC to control the size of the entries in the pgstats dshash. More normalization for IN and ANY clauses would also help a not here, these are a cause of a lot of bloat. This integration is not something I will be able to work on for the PG18 dev cycle as I'm in full review/commit mode for the rest of this release, but I got some plans for it in PG19 except if somebody beats me to it. -- Michael --okv+DDOfJM6YhplI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmc9DBQACgkQnvQgOdby QH3wnw/8D/XygIWPtPgFYpgOV98L5SWyG7lu5bTLp9EaWKM6LSpSyO8tOwYj+VU5 XH471uuKW6QIBeO8LTDSu0vIFOp2kDzIXXlUbPD0TxdLz/eXYnIJgIM1VtQy7xAI 5h7CAcn0ebNz1PHFLdTO1BXdyonM5El8cXS6xECHHgx/k2XvEXsinVgN0TWrJQNJ GRj1mrGOOiOKxIGhxzIZn5wsBjIrgIhaBnNmLc4mW6SN+pavEva9AM9B3A6TgCTV /H0Kpb19E7Bt+mfeDdArK5eM1k6z8BE7joJUQoR8gqDRF4HuEn13qJPLAHATwNlR jm8rT6nqKn5ALX139VSon+63PIdlCbF5JTjynkp36gJ/VPIhl3G8WIeuAEy9ceAN hY9AS1qqKEY1Mpr+R05hCMiUrAVdqRUDavjcr5eMnI9mdHbx6lYQ+fsRd36y+fbU XsuLnCgPEejZFINRYxvINqWE94kqQNGS3DHls/BHvT+gQSeLmcFKn1zxn1f0BuH+ EFFoVq/8Y9vNlJ68psvSoJXfaK/xaAH+uGfByoeKUburov+XlV60J0NOe7Rginrt OhTGrBPIflETP7cXSlGRIBL+ixk3C36AX4ctftFgmIW8g8YAsKEDstU4vpsnnyFo r3wmvNb0aVK5DT/+U5wt7OiL+9HjCN9v5a/KTAq+tWMpo2nv0MQ= =IQKy -----END PGP SIGNATURE----- --okv+DDOfJM6YhplI--