Thread: How to find a number of connections

How to find a number of connections

From
"Brusser, Michael"
Date:
<div class="Section1"><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">Is there a way to find a number of current connections on Postgres 7.3.x ?</span></font><p
class="MsoNormal"><fontface="Arial" size="2"><span style="font-size:10.0pt; 
font-family:Arial">I looked at some system tables and views, but did not see anything obvious.</span></font><p
class="MsoNormal"><fontface="Arial" size="2"><span style="font-size:10.0pt; 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">Thank you,</span></font><p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size:10.0pt;
font-family:Arial">Mike</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial"> </span></font></div>

Re: How to find a number of connections

From
"Brusser, Michael"
Date:

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

 

Re: How to find a number of connections

From
"Brusser, Michael"
Date:
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



Re: How to find a number of connections

From
Tom Lane
Date:
"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


Re: How to find a number of connections

From
Alvaro Herrera
Date:
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


Re: How to find a number of connections

From
"Jim C. Nasby"
Date:
It would be better to ask this on -general, but

SELECT count(*) FROM pg_stat_activity;

is what you want.

On Fri, Nov 11, 2005 at 12:35:28PM -0500, Brusser, Michael wrote:
> 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
> 
>  
> 

-- 
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461