pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Usage of pg_stat_database
3+ messages / 2 participants
[nested] [flat]

* Usage of pg_stat_database
@ 2011-10-24 14:04 Amitabh Kant <amitabhkant@gmail.com>
  2011-10-28 05:54 ` Re: Usage of pg_stat_database Jeff Davis <pgsql@j-davis.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Amitabh Kant @ 2011-10-24 14:04 UTC (permalink / raw)
  To: pgsql-performance

If I read the xact_commit field returned by "Select * from pg_stat_database"
multiple times, and then average the difference between consecutive values,
would this give an approx idea about the transactions per second in my
database?

Does this figure include the number of select statements being executed in
the db?


With regards

Amitabh

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Usage of pg_stat_database
  2011-10-24 14:04 Usage of pg_stat_database Amitabh Kant <amitabhkant@gmail.com>
@ 2011-10-28 05:54 ` Jeff Davis <pgsql@j-davis.com>
  2011-10-28 06:37   ` Re: Usage of pg_stat_database Amitabh Kant <amitabhkant@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Jeff Davis @ 2011-10-28 05:54 UTC (permalink / raw)
  To: Amitabh Kant <amitabhkant@gmail.com>; +Cc: pgsql-performance

On Mon, 2011-10-24 at 19:34 +0530, Amitabh Kant wrote:
> If I read the xact_commit field returned by "Select * from
> pg_stat_database" multiple times, and then average the difference
> between consecutive values, would this give an approx idea about the
> transactions per second in my database? 

Yes, approximately. It relies on the stats messages.

> Does this figure include the number of select statements being
> executed in the db? 
> 
Yes, a quick test shows that select statements count as well. However,
it seems that very simple selects, like "SELECT 1" might not send the
stats messages right away, and they might end up getting lost.

Regards,
	Jeff Davis





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Usage of pg_stat_database
  2011-10-24 14:04 Usage of pg_stat_database Amitabh Kant <amitabhkant@gmail.com>
  2011-10-28 05:54 ` Re: Usage of pg_stat_database Jeff Davis <pgsql@j-davis.com>
@ 2011-10-28 06:37   ` Amitabh Kant <amitabhkant@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Amitabh Kant @ 2011-10-28 06:37 UTC (permalink / raw)
  To: pgsql-performance

Thanks Jeff. This should help in getting a fairly approximate values.

Amitabh

On Fri, Oct 28, 2011 at 11:24 AM, Jeff Davis <pgsql@j-davis.com> wrote:

> On Mon, 2011-10-24 at 19:34 +0530, Amitabh Kant wrote:
> > If I read the xact_commit field returned by "Select * from
> > pg_stat_database" multiple times, and then average the difference
> > between consecutive values, would this give an approx idea about the
> > transactions per second in my database?
>
> Yes, approximately. It relies on the stats messages.
>
> > Does this figure include the number of select statements being
> > executed in the db?
> >
> Yes, a quick test shows that select statements count as well. However,
> it seems that very simple selects, like "SELECT 1" might not send the
> stats messages right away, and they might end up getting lost.
>
> Regards,
>         Jeff Davis
>
>
>

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2011-10-28 06:37 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-10-24 14:04 Usage of pg_stat_database Amitabh Kant <amitabhkant@gmail.com>
2011-10-28 05:54 ` Jeff Davis <pgsql@j-davis.com>
2011-10-28 06:37   ` Amitabh Kant <amitabhkant@gmail.com>

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