Re: Better Connection Statistics

From: bricklen <bricklen(at)gmail(dot)com>
To: Shaun Thomas <sthomas(at)optionshouse(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Better Connection Statistics
Date: 2014-02-07 22:27:10
Message-ID: CAGrpgQ8vSN8PYPPMmMJONkP4FpyDbKob19koqBOgdJSP=tRZ4A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice

On Fri, Feb 7, 2014 at 2:24 PM, bricklen <bricklen(at)gmail(dot)com> wrote:

>
> On Fri, Feb 7, 2014 at 10:08 AM, Shaun Thomas <sthomas(at)optionshouse(dot)com>wrote:
>
>> s I said in the original message, pg_stat_statements only gives query
>> stats for the whole database. What I want to know, is information about
>> each client. Say there's a specific connection from 192.168.1.20. I want to
>> know:
>>
>> * How many queries that connection has executed.
>> * How much CPU time that connection has used since it connected.
>> * How much data was sent to that connection.
>> * How much data that connection sent to the database.
>>
>> And so on. I don't believe that's currently possible. Effectively, it
>> would just be adding a few more columns to pg_stat_activity to track
>> cumulative totals, since it always has the status of all connections.
>>
>

I don't know any tools off-hand, but you might be able to generate partial
statistics from the log files with a descriptive log_line_prefix like "%m
[%p] (user=%u) (db=%d) (rhost=%h) [vxid:%v txid:%x] [%i] ". Using the %p
and vxi/txid might help to group the queries executed for easier
consumption. I don't think that helps much with individual connections
though.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shaun Thomas 2014-02-07 22:36:00 Re: Better Connection Statistics
Previous Message bricklen 2014-02-07 22:24:58 Re: Better Connection Statistics

Browse pgsql-novice by date

  From Date Subject
Next Message Shaun Thomas 2014-02-07 22:36:00 Re: Better Connection Statistics
Previous Message bricklen 2014-02-07 22:24:58 Re: Better Connection Statistics