How to find which query a waiting query waiting for?

Started by wdover 13 years ago4 messagesgeneral
Jump to latest
#1wd
wd@wdicc.com

hi,

From pg_stat_activity I can find a query is at waiting state, and from
pg_locks and pg_class can find which relation the query is waiting for, But
how to find witch query is lock the relation?

In reply to: wd (#1)
Re: How to find which query a waiting query waiting for?

On Fri, Dec 07, 2012 at 11:02:33PM +0800, wd wrote:

From pg_stat_activity I can find a query is at waiting state, and from
pg_locks and pg_class can find which relation the query is waiting for, But
how to find witch query is lock the relation?

sipmply check which query has lock on the relation/transaction what your
query is waiting for.

Best regards,

depesz

--
The best thing about modern society is how easy it is to avoid contact with it.
http://depesz.com/

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Fabrízio de Royes Mello
fabriziomello@gmail.com
In reply to: wd (#1)
Re: How to find which query a waiting query waiting for?

On Fri, Dec 7, 2012 at 1:02 PM, wd <wd@wdicc.com> wrote:

hi,

From pg_stat_activity I can find a query is at waiting state, and from
pg_locks and pg_class can find which relation the query is waiting for, But
how to find witch query is lock the relation?

Maybe you found what you need here [1]http://wiki.postgresql.org/wiki/Lock_Monitoring.

[1]: http://wiki.postgresql.org/wiki/Lock_Monitoring

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL

Show quoted text

Blog sobre TI: http://fabriziomello.blogspot.com
Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
Twitter: http://twitter.com/fabriziomello

#4wd
wd@wdicc.com
In reply to: Fabrízio de Royes Mello (#3)
Re: How to find which query a waiting query waiting for?

I know how to do this, thanks.

On Fri, Dec 7, 2012 at 11:09 PM, Fabrízio de Royes Mello <
fabriziomello@gmail.com> wrote:

Show quoted text

On Fri, Dec 7, 2012 at 1:02 PM, wd <wd@wdicc.com> wrote:

hi,

From pg_stat_activity I can find a query is at waiting state, and from
pg_locks and pg_class can find which relation the query is waiting for, But
how to find witch query is lock the relation?

Maybe you found what you need here [1].

[1] http://wiki.postgresql.org/wiki/Lock_Monitoring

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL

Blog sobre TI: http://fabriziomello.blogspot.com
Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
Twitter: http://twitter.com/fabriziomello