Thread: Help with process list

Help with process list

From
Cristian Prieto
Date:
Hello, I have a couple of bussy pgsql 8 servers running in my office, in
MySQL I use SHOW PROCESSLIST to show the actual process running in the
MySQL server (idle time, resources and other statistical data) and a
little perl app named mytop to show the data like the top unix
utility... There such way to do the same or similar stuff in PostgreSQL?

Thanks a lot...


Re: Help with process list

From
Pavel Stehule
Date:
On Thu, 14 Apr 2005, Cristian Prieto wrote:

> Hello, I have a couple of bussy pgsql 8 servers running in my office, in
> MySQL I use SHOW PROCESSLIST to show the actual process running in the
> MySQL server (idle time, resources and other statistical data) and a
> little perl app named mytop to show the data like the top unix
> utility... There such way to do the same or similar stuff in PostgreSQL?
>
> Thanks a lot...
>

Hello,

you can use

intra=# SELECT * from pg_stat_activity ;
 datid | datname | procpid | usesysid | usename | current_query |
query_start
-------+---------+---------+----------+---------+---------------+-------------------------------
 17234 | intra   |   10782 |      100 | root    | <IDLE>        |
2005-04-14 22:02:12.952476+02
 17234 | intra   |   16274 |      100 | root    | <IDLE>        |
2005-04-14 22:03:10.109273+02
 17234 | intra   |   19010 |      100 | root    | <IDLE>        |
2005-04-14 22:02:13.216437+02
 17234 | intra   |    9403 |      100 | root    | <IDLE>        |
2005-04-14 22:04:14.739074+02
 17234 | intra   |    8605 |      100 | root    | <IDLE>        |
2005-04-14 22:04:28.406897+02
 17234 | intra   |    1426 |      100 | root    | <IDLE>        |
2005-04-14 22:03:08.89732+02
 17234 | intra   |    5497 |      100 | root    | <IDLE>        |
2005-04-14 22:04:14.506181+02
(7 rows)


Regards
Pavel Stehule


Re: Help with process list II

From
Pavel Stehule
Date:
On Thu, 14 Apr 2005, Cristian Prieto wrote:

> Hello, I have a couple of bussy pgsql 8 servers running in my office, in
> MySQL I use SHOW PROCESSLIST to show the actual process running in the
> MySQL server (idle time, resources and other statistical data) and a
> little perl app named mytop to show the data like the top unix
> utility... There such way to do the same or similar stuff in PostgreSQL?
>

PostgreSQL can log long time executed sql commands. Set
log_min_duration_statement on some value in your postgresql.conf file.
I have good experience with it. Its very usefull for finding long sql
cmds.

regards
Pavel Stehule