Re: Queries and Transactions per second - PostgreSQL 9.2

From: bricklen <bricklen(at)gmail(dot)com>
To: Patrick B <patrickbakerbr(at)gmail(dot)com>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Queries and Transactions per second - PostgreSQL 9.2
Date: 2016-06-29 17:09:49
Message-ID: CAGrpgQ-ShVDgGWphpqVOy0fODyuEq9exNsHwv=mxKqZDxFuzyw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Tue, Jun 28, 2016 at 9:00 PM, Patrick B <patrickbakerbr(at)gmail(dot)com> wrote:

> I wanna get how many queries and transactions my DB is doing per second...
>
> is that a way to get that? maybe using pg_stat_statements?
>

As mentioned in another reply, you can determine the queries per second
being executed if you turn on full logging and run the log through pgbadger
(for example).
For transactions, sampling the pg_stat_database relation will give you
transaction stats.
For example:
SELECT current_setting('port')::INTEGER as port, datname AS dbname,
SUM(xact_commit)+SUM(xact_rollback) AS transactions
FROM pg_stat_database
WHERE datname NOT IN ('template0','template1')
GROUP BY datname ;

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2016-06-29 17:20:34 Re: GIN vs BTREE - query planner picking the wrong one some times
Previous Message Steve Crawford 2016-06-29 04:03:45 Re: Queries and Transactions per second - PostgreSQL 9.2