Postgres性能检测

# top -c
PID USER     PRI NI SIZE RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND
14442 postgres 25   0 47632 46M 44468 R     7.2 1.1   0:03   0 postgres: postgres gudumami 192.168.2.206(45351) SELECT
13834 postgres 16   0 88992 86M 86408 S     1.8 2.1   2:02   0 postgres: postgres gudumami 192.168.2.206(45158) idle
13806 postgres 15   0 88956 86M 86464 S     1.2 2.1   2:58   0 postgres: postgres gudumami 192.168.2.206(45094) idle
25132 postgres 15   0 90656 88M 86972 S     0.4 2.1 1107m   0 postgres: postgres gudumami 192.168.2.206(33654) idle
21720 postgres 15   0 2272 2268 1680 S     0.2 0.0 288:27   1 postgres: stats collector process
21718 postgres 15   0 85660 83M 84944 S     0.1 2.0 363:52   0 postgres: writer process


用explain来看看他的execute plan
gudumami=#explain select * from user_basic where user_id='coffeehan';

ps -ef | grep postgres

SELECT pg_stat_get_backend_pid(s.backendid) AS procpid,
       pg_stat_get_backend_activity(s.backendid) AS current_query
    FROM (SELECT pg_stat_get_backend_idset() AS backendid) AS s;

select * from (SELECT pg_stat_get_backend_pid(s.backendid) AS procpid, pg_stat_get_backend_activity(s.backendid) AS current_query FROM (SELECT pg_stat_get_backend_idset() AS backendid) AS s) as querystring;

http://www.pgsqldb.org/pgsqldoc-cvs/monitoring-stats.html
http://www.pgsqldb.org/pgsqldoc-cvs/monitoring.html

posted @ 2012-04-17 11:21  功夫 熊猫  阅读(650)  评论(0编辑  收藏  举报