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 1r5puC-00FJPd-DA for pgsql-general@arkaria.postgresql.org; Wed, 22 Nov 2023 16:16:48 +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 1r5puA-00AFjw-UZ for pgsql-general@arkaria.postgresql.org; Wed, 22 Nov 2023 16:16:46 +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 1r5puA-00AFhY-1O for pgsql-general@lists.postgresql.org; Wed, 22 Nov 2023 16:16:46 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r5pu7-006pg3-31 for pgsql-general@lists.postgresql.org; Wed, 22 Nov 2023 16:16:44 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 0AC815C022E; Wed, 22 Nov 2023 11:16:42 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 22 Nov 2023 11:16:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1700669802; x= 1700756202; bh=Z9096aJcxYod710ymQ35WqNtYgMwUitQbTMj6Tm6tFQ=; b=z v6x/KzJcc/8kgX0LPSs2qN3rNKWgBs5F5GQnOyAwCl57VvShrQLBBq1bUT9R5OzM dTDBccvJMGrQ6VlFviUZOwcUqVz4pqVAFU2KiNZZtoXi8WFo+gl37XShtBcohUw6 d8DtNR6rgEc2SsWFXjAaKX2KxGf9ZjxxfrnsQgE5V+4Gvya+neYCTGOcorXboiEM pMA16/8Hy6twYgbgm2tyw3o47ANtWSLTYRg8ALDhJKDsoc4T65QDQNh5CH7HWCW9 yn6+Py8c96C5l6TuonSB0gSB8TLCrmUmEDV9tRwgPdfZNlw8CgkohBx962mOQtiI 1RdRpRWlDv8t/x2+NXxug== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehuddgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepleejledvledutdeuhfdvgeefvefhgeffffejvefhvddt gfeftdetieegtddtveetnecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghdpph hoshhtghhrrdgvshdpvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhh drnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 22 Nov 2023 11:16:41 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1700669797; bh=N6TXC7psUItmISvGFpurREJn0YmI7Tj4I2e1/7Un0KI=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=hbjR3r8Ps48CjsDaqkHkXuUKBsiEm7dGzYofihn2zcqe9w9QzV+8vPFSCBRwH+E2A fXpxxFn+xkFYb0qmdygVSIqS5L3A0qsRdfgCwJ8P9XyrLaXrYWjnGZ0JWWJbHrmFpA H90EDToEdVpaDT8tqhEHyV7V8SxtEzVETkywvkFPflYlTiCgRgO98M3cJL/Oi0AQ1+ Igi9lGSZo4ZzGh7rxOhMA4SHqWLJBCatjzpKCkUH64wR8KujOyCe8jtN2EUJlK33Y9 8z+ZAymeKQz4UbHfgAQEJWvn5uCjUfI6pKz/CB4NmGi4Wyv7dVhmbxf2udgGe4HU+R HPPqBBh8zLH4Q== Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id C94D1A5; Wed, 22 Nov 2023 17:16:37 +0100 (CET) Date: Wed, 22 Nov 2023 17:16:37 +0100 From: Alvaro Herrera To: Dominique Devienne Cc: pgsql-general@lists.postgresql.org Subject: Re: LibPQ: PQresultMemorySize as proxy to transfered bytes Message-ID: <202311221616.bkvtixw2nw3n@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-Jun-28, Dominique Devienne wrote: > And if there's a better proxy to programmatically know the network > traffic exchanged on the connection's socket, that's cross-platform? > Obviously > libpq itself knows, but I don't see any way to access that info. > > Perhaps tracing might? But will that incur overhead? Maybe you can use PQtrace()[1], yeah. It will indicate, for each message transmitted, its size in bytes. Naturally there will be some overhead in writing the trace file. Also, the format of the output file has some issues[2] that may make it difficult to machine-parse. But it might be good enough for you ... or you might find yourself motivated to fix these problems. [1] https://www.postgresql.org/docs/current/libpq-control.html#LIBPQ-PQTRACE [2] https://www.postgr.es/m/CAFCRh-8OPoe%3D0j9v4wth7qU-x4jvjVc8DoOLV66qdnC9Do0ymw%40mail.gmail.com -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "Doing what he did amounts to sticking his fingers under the hood of the implementation; if he gets his fingers burnt, it's his problem." (Tom Lane)