Re: How to get total count of queries hitting DB per day or per hour?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: "Sheena, Prabhjot" <Prabhjot(dot)Singh(at)classmates(dot)com>, Melvin Davidson <melvin6925(at)gmail(dot)com>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to get total count of queries hitting DB per day or per hour?
Date: 2015-07-09 20:35:59
Message-ID: 559EDB2F.9080603@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 07/09/2015 01:26 PM, Sheena, Prabhjot wrote:
> Thanks a lot. That’s what I am looking for

Might also want to look at:

http://www.postgresql.org/docs/9.4/static/pgstatstatements.html

>
> Thanks
>
> */Prabhjot Singh/*
>
> *From:*Melvin Davidson [mailto:melvin6925(at)gmail(dot)com]
> *Sent:* Thursday, July 9, 2015 1:24 PM
> *To:* Scott Marlowe
> *Cc:* Sheena, Prabhjot; pgsql-general(at)postgresql(dot)org
> *Subject:* Re: [GENERAL] How to get total count of queries hitting DB
> per day or per hour?
>
> Run two cron jobs, each runs exacty 24 hours apart.
> Each gets the result of the following query:
>
> SELECT SUM(xact_commit + xact_rollback)
> FROM pg_stat_database;
>
> Then subtract the result of the first cron from the second.
> That's the number of transactions in a 24 hr period.
>
> On Thu, Jul 9, 2015 at 4:07 PM, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com
> <mailto:scott(dot)marlowe(at)gmail(dot)com>> wrote:
>
> On Thu, Jul 9, 2015 at 12:04 PM, Sheena, Prabhjot
> <Prabhjot(dot)Singh(at)classmates(dot)com
> <mailto:Prabhjot(dot)Singh(at)classmates(dot)com>> wrote:
> > Guys
> >
> > Is there a way to get total count of queries hitting
> > Postgresql DB(verison 9.3) per day or per hour ? I cannot turn on
> > log_statement=all coz that’s too much logging for our log file to
> handle. Is
> > there another way to do that.
>
> If you just need totals, turn on just log_duration and then you can
> grep the logs etc for that.
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org
> <mailto:pgsql-general(at)postgresql(dot)org>)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
>
>
>
> --
>
> *Melvin Davidson*
> *I reserve the right to fantasize. Whether or not you
> wish to share my fantasy is entirely up to you. Image removed by sender.*
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Reyes 2015-07-10 04:12:57 Re: How to test SSL cert from CA?
Previous Message Sheena, Prabhjot 2015-07-09 20:26:15 Re: How to get total count of queries hitting DB per day or per hour?