From: | Dmitry Dolgov <9erthalion6(at)gmail(dot)com> |
---|---|
To: | Franklin Haut <franklin(dot)haut(at)gmail(dot)com> |
Cc: | "pgsql-performance(at)lists(dot)postgresql(dot)org" <pgsql-performance(at)lists(dot)postgresql(dot)org>, Sergei Kornilov <sk(at)zsrv(dot)org>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
Subject: | Re: Log size in bytes of query result |
Date: | 2019-05-22 13:15:16 |
Message-ID: | CA+q6zcWx28OQ0yV9UVENa3JKChUvWi0DZiXOhjT6SeYsg2uEow@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
> On Wed, May 22, 2019 at 2:51 PM Franklin Haut <franklin(dot)haut(at)gmail(dot)com> wrote:
>
> By my analysis, I see that the most efficient way to perform this control
> would be in the existing medium in postgresql that is the log file (pg_log)
> adding a few more variables for each query executed.
> On Fri, May 10, 2019 at 6:42 PM Sergei Kornilov <sk(at)zsrv(dot)org> wrote:
>
> We have any hooks that can be used for such purposes? Sometimes I think how
> to implement counters "bytes sent to client"/"bytes recv from client" in
> pg_stat_statements but did not found good place. Where we can accumulate such
> counters and how they can be accessible from extension? Extend DestReceiver
> or add counter directly in src/backend/libpq/pqcomm.c ?
For the records, I guess on Linux you can gather such kind of information via
ebpf, even without hooks in Postgres (if you avoid too frequent context
switches between kernel/user space via e.g. relying on send/recv, it should be
also efficient). I have a POC in my postgres-bcc repo, it looks like this:
$ net_per_query.py bin/postgres -c $container_id
attaching...
listening...
detaching...
sent
[16397:4026532567] copy pgbench_accounts from stdin: 16b
[16397:4026532567] alter table pgbench_accounts add primary key (aid): 96b
[16428:4026532567] postgres: backend 16428: 2k
received
[16397:4026532567] copy pgbench_accounts from stdin: 16m
From | Date | Subject | |
---|---|---|---|
Next Message | Mariel Cherkassky | 2019-05-22 15:26:49 | pg_restore takes more time on creation of rules |
Previous Message | Franklin Haut | 2019-05-22 12:50:52 | Re: Log size in bytes of query result |