3

Currently I am working on PostgreSQL Performance Analysis where I am using prefix %t %d for logging.

When I try to analysis log files, I found that lots of errors, logs outcome of analyse vaccum and system related process, those logs occupy maximum of the file space, so it's very difficult to find queries need to analyze which from application.

Please help me to suggest a solution, so that can able to maintain each separately in Postgresql Logging. Any suggestions?

2
  • try pg_stat_statements extension Commented Jul 19, 2016 at 6:01
  • You could add the username (%u) the application name (%a) or maybe the session ID (%c) to the logfile prefix. Or you can add the username only for "real" sessions using %q%u Commented Jul 19, 2016 at 7:05

1 Answer 1

1

You cannot have multiple log files for different event types, but you can tune postgresql.conf so that you only get what you really need.

I use pgBadger for query analysis, it parses your log file and tells you (among many other things) which queries (normalized by ignoring constants) ran most frequently, which took the most time and which individual queries had the longest runtime.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.