Anyway to know which users are connected to postgres?

Started by Peter E. Chenabout 24 years ago6 messagesgeneral
Jump to latest
#1Peter E. Chen
pchen3@jhmi.edu

Hey All,

I'd like to know if there is anyway one can figure out who is currently
connected to the database.

Thanks,
Peter

#2Bruce Momjian
bruce@momjian.us
In reply to: Peter E. Chen (#1)
Re: Anyway to know which users are connected to postgres?

Peter E. Chen wrote:

Hey All,

I'd like to know if there is anyway one can figure out who is currently
connected to the database.

You can use ps to see args of connected users, or pg_monitor at:

http://gborg.postgresql.org/project/pgmonitor

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter E. Chen (#1)
Re: Anyway to know which users are connected to postgres?

"Peter E. Chen" <pchen3@jhmi.edu> writes:

I'd like to know if there is anyway one can figure out who is currently
connected to the database.

In 7.2 there is a system view pg_stat_activity.

Since about 7.0, a "ps" listing will show the owning user for each
postgres backend process (on most platforms, anyway).

regards, tom lane

#4Jeffrey W. Baker
jwbaker@acm.org
In reply to: Peter E. Chen (#1)
Re: Anyway to know which users are connected to postgres?

On Mon, 14 Jan 2002, Peter E. Chen wrote:

Hey All,

I'd like to know if there is anyway one can figure out who is currently
connected to the database.

On Linux at least, the output of 'ps' shows the user, the database they
are connected to, and the host they are connected from.

-jwb

#5Elein
elein@nextbus.com
In reply to: Peter E. Chen (#1)
Re: Anyway to know which users are connected to postgres?

Tom Lane wrote:

"Peter E. Chen" <pchen3@jhmi.edu> writes:

I'd like to know if there is anyway one can figure out who is currently
connected to the database.

In 7.2 there is a system view pg_stat_activity.

Since about 7.0, a "ps" listing will show the owning user for each
postgres backend process (on most platforms, anyway).

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

This is very nice. I can't ever see the current query, however,
even as postgres. Is this column just to tease us? I can
see it could be a security issue.

elein

--
--------------------------------------------------------
elein@nextbus.com
(510)420-3120
www.nextbus.com
spinning to infinity, hallelujah
--------------------------------------------------------

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Elein (#5)
Re: Anyway to know which users are connected to postgres?

Elein <elein@nextbus.com> writes:

In 7.2 there is a system view pg_stat_activity.

This is very nice. I can't ever see the current query, however,
even as postgres. Is this column just to tease us? I can
see it could be a security issue.

You need to turn on query stats. See
http://developer.postgresql.org/docs/postgres/monitoring-stats.html

regards, tom lane