Re: Who is locking me?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bill Moran <wmoran(at)potentialtech(dot)com>
Cc: "Abraham, Danny" <danny_abraham(at)bmc(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Who is locking me?
Date: 2010-03-18 19:37:15
Message-ID: 16029.1268941035@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bill Moran <wmoran(at)potentialtech(dot)com> writes:
> In response to "Abraham, Danny" <danny_abraham(at)bmc(dot)com>:
>> - Can I retrieve the Client PID somewhere (then by process name I will dive into the code).

> If you're on a POSIX system, you can use netstat to find out the details of
> the socket the backend is connected to.

Looking at all the columns of pg_stat_activity, rather than just some of
them, should provide the client address and port number. I guess you'd
still need netstat or lsof or some other tool to find out what process
owns that port though.

It's quite peculiar that the given query hangs though. Right offhand,
the only thing I can think of that might block it is an exclusive lock
on pg_proc, or one of the other system catalogs that the parser has to
consult to process the query. It's *extremely* bad form for a client
to take such a lock at all, much less sit on it while doing nothing.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tim Bruce - Postgres 2010-03-18 19:37:18 Re: Who is locking me?
Previous Message Bill Moran 2010-03-18 19:29:20 Re: Who is locking me?