Re: LibPQ: PQresultMemorySize as proxy to transfered bytes - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: LibPQ: PQresultMemorySize as proxy to transfered bytes
Date
Msg-id 202311221616.bkvtixw2nw3n@alvherre.pgsql
Whole thread Raw
In response to LibPQ: PQresultMemorySize as proxy to transfered bytes  (Dominique Devienne <ddevienne@gmail.com>)
List pgsql-general
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)



pgsql-general by date:

Previous
From: Ron Johnson
Date:
Subject: Configuration knobs & dials to speed up query optimization
Next
From: Erik Wienhold
Date:
Subject: Re: Feature request: pg_get_tabledef(text)