From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Dominique Devienne <ddevienne@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: LibPQ: PQresultMemorySize as proxy to transfered bytes
Date: Wed, 22 Nov 2023 17:16:37 +0100
Message-ID: <202311221616.bkvtixw2nw3n@alvherre.pgsql> (raw)
In-Reply-To: <CAFCRh-9MoKJjv4J156RvOtg5hmMXM7XPqNYMQVqijkezQq5tug@mail.gmail.com>
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)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: alvherre@alvh.no-ip.org, ddevienne@gmail.com
Subject: Re: LibPQ: PQresultMemorySize as proxy to transfered bytes
In-Reply-To: <202311221616.bkvtixw2nw3n@alvherre.pgsql>
References: <CAFCRh-9MoKJjv4J156RvOtg5hmMXM7XPqNYMQVqijkezQq5tug@mail.gmail.com> <202311221616.bkvtixw2nw3n@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox