How to find a number of connections

Started by Brusser, Michaelabout 20 years ago7 messages
#1Brusser, Michael
Michael.Brusser@matrixone.com

Is there a way to find a number of current connections on Postgres 7.3.x
?

Thank you,
Mike

#2Bruno Wolff III
bruno@wolff.to
In reply to: Brusser, Michael (#1)
Re: How to find a number of connections

On Fri, Nov 11, 2005 at 15:09:41 -0500,
"Brusser, Michael" <Michael.Brusser@matrixone.com> wrote:

Is there a way to find a number of current connections on Postgres 7.3.x
?

This might help you:
http://www.postgresql.org/docs/7.3/static/monitoring.html

#3Bryan White
bryan@arcamax.com
In reply to: Brusser, Michael (#1)
Re: How to find a number of connections

Brusser, Michael wrote:

Is there a way to find a number of current connections on Postgres 7.3.x
?

select count(*) from pg_stat_activity

--
Bryan White, ArcaMax Publishing Inc.

I never look back, darling. it distracts from the now. - Edna Mode

#4Brusser, Michael
Michael.Brusser@matrixone.com
In reply to: Bryan White (#3)
Re: How to find a number of connections

Please disregard this duplicate submission, my mistake.

Mike

________________________________

From: pgsql-hackers-owner@postgresql.org
[mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Brusser,
Michael
Sent: Friday, November 11, 2005 12:35 PM
To: pgsql-hackers@postgresql.org
Subject: [HACKERS] How to find a number of connections

Is there a way to find a number of current connections on Postgres 7.3.x
?

I looked at some system tables and views, but did not see anything
obvious.

Thank you,

Mike

#5Brusser, Michael
Michael.Brusser@matrixone.com
In reply to: Brusser, Michael (#4)
Re: How to find a number of connections

Thank you, this is very handy.
I'd like to understand why the result of this query is different
from the number of Postgres processes reported by `ps`.
(The query returns 8, ps shows 11)

One process is really postmaster, the others seem to be doing some
house chores: stats buffer process and stats collector process.
Do they actually use connections, decrementing what's available from
the max_connections value?

Thank you

-----Original Message-----
From: pgsql-hackers-owner@postgresql On Behalf Of Bryan White
... ...

Brusser, Michael wrote:

Is there a way to find a number of current connections on Postgres
7.3.x ?

select count(*) from pg_stat_activity

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Brusser, Michael (#5)
Re: How to find a number of connections

"Brusser, Michael" <Michael.Brusser@matrixone.com> writes:

One process is really postmaster, the others seem to be doing some
house chores: stats buffer process and stats collector process.
Do they actually use connections,

No.

regards, tom lane

#7Alvaro Herrera
alvherre@commandprompt.com
In reply to: Tom Lane (#6)
Re: How to find a number of connections

Tom Lane wrote:

"Brusser, Michael" <Michael.Brusser@matrixone.com> writes:

One process is really postmaster, the others seem to be doing some
house chores: stats buffer process and stats collector process.
Do they actually use connections,

No.

But note that in 8.1, autovacuum does.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support