Re: Monitoring number of backends - Mailing list pgsql-general

From Jeff Janes
Subject Re: Monitoring number of backends
Date
Msg-id CAMkU=1wJ=7cyyxFTKjuAFbRx8fEXnc20yHMXPcNMdw6o0WL7JA@mail.gmail.com
Whole thread Raw
In response to Monitoring number of backends  (andy <andy@squeakycode.net>)
List pgsql-general
On Tue, Oct 22, 2013 at 10:41 AM, andy <andy@squeakycode.net> wrote:
Hi all.

My website is about to get a little more popular.  I'm trying to add in some measurements to determine an upper limit of how many concurrent database connections I'm currently using.

I've started running this:

SELECT sum(numbackends) AS count, sum(xact_commit) as ttlcommit FROM pg_stat_database;

Every 10 seconds or so.  I don't think its what I want though.  It seems way too small.  I'm guessing that its not a measure of the previous 10 seconds.  Its a count of how many backends are in use at the exact moment I run the sql.

Is there a cumulative count someplace?

You can pull it from the log files if you change postgres.conf to use:

log_connections = on
log_disconnections = on

Cheers,

Jeff

pgsql-general by date:

Previous
From: Marko Kreen
Date:
Subject: Re: Monitoring number of backends
Next
From: Jeff Janes
Date:
Subject: Re: Monitoring number of backends