Unix Technical Forum

View running Processes ?

This is a discussion on View running Processes ? within the pgsql Novice forums, part of the PostgreSQL category; --> Hi List ! Is there an equivalent of mysql's "SHOW PROCESSLIST" command in PostgreS ? Sometimes my server takes ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Novice

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 10:37 PM
Arnaud Lesauvage
 
Posts: n/a
Default View running Processes ?

Hi List !

Is there an equivalent of mysql's "SHOW PROCESSLIST" command in
PostgreS ?
Sometimes my server takes a lot of processing power, and I would
like to know what it is doing.

Also, is there no way to kill a running query from *within*
postgres ? With a query, or something similar ?
The only way I found to kill running queries was to "kill <pid>"
from a command prompt, but that is not very clean, I can't run
this from a remote client.

Thanks a lot !

Regards
--
Arnaud



---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-17-2008, 10:37 PM
A. Kretschmer
 
Posts: n/a
Default Re: View running Processes ?

am 24.02.2006, um 10:32:26 +0100 mailte Arnaud Lesauvage folgendes:
> Hi List !
>
> Is there an equivalent of mysql's "SHOW PROCESSLIST" command in
> PostgreS ?


select * from pg_stat_activity;
You should set
stats_command_string = on

in your postgresql.conf



HTH, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47215, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-17-2008, 10:37 PM
Arnaud Lesauvage
 
Posts: n/a
Default Re: View running Processes ?

A. Kretschmer a écrit :
> select * from pg_stat_activity;
> You should set
> stats_command_string = on
>
> in your postgresql.conf



Thanks Andreas ! Exactly what I was looking for !

Since you don't mention it, I understand that there is no way to
stop a running query from a postgresql wlient application ?


Regards
--
Arnaud


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

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-17-2008, 10:37 PM
A. Kretschmer
 
Posts: n/a
Default Re: View running Processes ?

am 24.02.2006, um 10:32:26 +0100 mailte Arnaud Lesauvage folgendes:
> Also, is there no way to kill a running query from *within*
> postgres ? With a query, or something similar ?


http://www.postgresql.org/docs/8.1/i...ons-admin.html
pg_cancel_backend(pid int)


HTH, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47215, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===

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

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-17-2008, 10:37 PM
Arnaud Lesauvage
 
Posts: n/a
Default Re: View running Processes ?

A. Kretschmer a écrit :
> http://www.postgresql.org/docs/8.1/i...ons-admin.html
> pg_cancel_backend(pid int)


Oh yes ! So if I understand correctly, I get the pid of the query
with "select * from pg_stat_activity;", then I just kill the query
with "select pg_cancel_backend(<pid>);" ?
Very nice !

PS : Sorry for asking this kind of questions when the answers are
in the doc, but I find it quite difficult to find informations in
the only doc. Maybe it is because I am used to access and mysql,
and the terminology used in postgres is quite different...


Regard
--
Arnaud


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-17-2008, 10:37 PM
A. Kretschmer
 
Posts: n/a
Default Re: View running Processes ?

am 24.02.2006, um 11:00:33 +0100 mailte Arnaud Lesauvage folgendes:
> A. Kretschmer a écrit :
> >select * from pg_stat_activity;
> >You should set stats_command_string = on
> >in your postgresql.conf

>
>
> Thanks Andreas ! Exactly what I was looking for !
>
> Since you don't mention it, I understand that there is no way to stop a
> running query from a postgresql wlient application ?


See my other answer, and you can set

statement_timeout = <timeout in ms>

Aborts any statement that takes over the specified number of
milliseconds. A value of zero turns off the timer.


See also:
http://www.powerpostgresql.com/Downl...d_conf_80.html


HTH, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47215, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:19 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com