"pgFouine is a PostgreSQL log analyzer used to generate detailed reports from a PostgreSQL log file. pgFouine can help you to determine which queries you should optimize to speed up your PostgreSQL based application."

you can use syslog or stderr

for example :use syslog

1. edit your /etc/syslog.conf
Quotation
  local0.*    -/var/log/pgsql

Quotation

*.info;mail.none;authpriv.none;cron.none;local0.none                /var/log/messages



2. edit postgresl.conf
Quotation
log_destination = 'syslog'
silent_mode = on

log_min_duration_statement = 0
#set to 0  log all
#set to -1 ,disable query logging
#set to X(positive integral) ,means to log queries slower than X milliseconds:

log_duration = off
log_statement = 'all'


3.download pgFouine
http://pgfouine.projects.postgresql.org/index.html

than restart syslogd and postgresql

4. analyse log
./pgfouine.php -file /var/log/postgresql/pgsql > askwan.com.html

Open in new window

use stderr please refer to http://gkoenig.wordpress.com/2009/02/19/pgfouine-dive-into-postgres-log/

作者:askwan@『AskWan』
地址:http://www.askwan.com/use_pgFouine_analyse_postgresql_slow_queries/
可以转载,转载时请以链接形式注明作者和原始出处及本声明!

DataBase | Comments(0) | Trackbacks(0) | Reads(450)
收藏到网摘:百度搜藏 Google书签 Yahoo收藏 新浪ViVi收藏夹 365天天网摘 天极网摘 我摘·网摘·网络书签 POCO网摘 和讯网摘 Bolaa博拉博客收录中心 天下图摘
Add a comment
Emots
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
Enable HTML
Enable UBB
Enable Emots
Hidden
Remember
Nickname   Password   Optional
Site URI   Email   [Register]