Re: Finding connected users

Lists: pgsql-novice
From: "M(dot) Bastin" <marcbastin(at)mindspring(dot)com>
To: PgSQL Novice ML <pgsql-novice(at)postgresql(dot)org>
Subject: Finding connected users
Date: 2003-09-12 10:10:30
Message-ID: a06002006bb874b069d43@[192.168.0.14]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Hi,

I posted this question before on this list but got no replies and
still didn't find the answer myself, so here's another attempt:

How can I find the currently connected users? I.e. what query must I
use from a TCP/IP client?

Thanks,

Marc

----------------
Original question:

I would like to know what the best queries are to get system status info like:

Number of connected users
List of connected user names with the database to which they are connected
List of used databases with number of currently connected users
Last startup date and time of PostgreSQL
IP address

etc. (If anybody can think of anything else)
I already know SELECT VERSION() ;-)

(on version 7.3, on a client over TCP/IP)


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "M(dot) Bastin" <marcbastin(at)mindspring(dot)com>
Cc: PgSQL Novice ML <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Finding connected users
Date: 2003-09-12 14:13:50
Message-ID: 10697.1063376030@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

"M. Bastin" <marcbastin(at)mindspring(dot)com> writes:
> How can I find the currently connected users?

The pg_stat_activity system view will help, assuming you haven't turned
off the stats-collection subsystem.

regards, tom lane


From: "Patrick Hatcher" <PHatcher(at)macys(dot)com>
To: marcbastin(at)mindspring(dot)com
Cc: PgSQL Novice ML <pgsql-novice(at)postgresql(dot)org>, pgsql-novice-owner(at)postgresql(dot)org
Subject: Re: Finding connected users
Date: 2003-09-12 15:34:38
Message-ID: OF5513081F.6656B5A4-ON88256D9F.005572D1-88256D9F.005638F2@fds.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice


Select * from pg_stat_activity

HTH
Patrick Hatcher

|--------+--------------------------------->
| | "M. Bastin" |
| | <marcbastin(at)mindspring(dot)|
| | com> |
| | Sent by: |
| | pgsql-novice-owner(at)post|
| | gresql.org |
| | |
| | |
| | 09/12/2003 03:10 AM |
|--------+--------------------------------->
>----------------------------------------------------------------------------------------------------------|
| |
| To: PgSQL Novice ML <pgsql-novice(at)postgresql(dot)org> |
| cc: |
| Subject: [NOVICE] Finding connected users |
>----------------------------------------------------------------------------------------------------------|

Hi,

I posted this question before on this list but got no replies and
still didn't find the answer myself, so here's another attempt:

How can I find the currently connected users? I.e. what query must I
use from a TCP/IP client?

Thanks,

Marc

----------------
Original question:

I would like to know what the best queries are to get system status info
like:

Number of connected users
List of connected user names with the database to which they are connected
List of used databases with number of currently connected users
Last startup date and time of PostgreSQL
IP address

etc. (If anybody can think of anything else)
I already know SELECT VERSION() ;-)

(on version 7.3, on a client over TCP/IP)

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
message can get through to the mailing list cleanly