Re: Find the Person Connected to a Database

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Milen A(dot) Radev" <milen(at)radev(dot)net>
Cc: pgsql-admin(at)postgresql(dot)org, Naomi Walker <nwalker(at)mhs(dot)mphasis(dot)com>
Subject: Re: Find the Person Connected to a Database
Date: 2007-10-26 23:09:00
Message-ID: 1065.1193440140@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

"Milen A. Radev" <milen(at)radev(dot)net> writes:
> Naomi Walker :
>> I'm trying to drop a database in a postgres 8.1.4 instance (x86 Solaris
>> 10 OS), but someone is connected to
>> the database. What is the best way to find out exactly who is connected?

> select * from pg_stat_activity where datname = <the_db_about_to_be_dropped>;

If that doesn't work because you've got stats collection turned off,
"ps" will help too:

http://www.postgresql.org/docs/8.1/static/monitoring.html

On Solaris, note the Tip at the bottom (not sure if it applies to recent
Solaris versions but a few years ago it was critical).

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Naomi Walker 2007-10-26 23:17:43 Re: Find the Person Connected to a Database
Previous Message Joshua D. Drake 2007-10-26 22:42:02 Re: way to turn off epochs in log_filename