Created
October 25, 2016 16:00
-
-
Save mccun934/51b52548b829ebf2ed54502230e6db48 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Edit /var/lib/pgsql/data/postgresql.conf | |
2) Change log_min_duration_statement to 500: | |
log_min_duration_statement = 500 # -1 is disabled, 0 logs all statements | |
# and their durations, > 0 logs only | |
# statements running at least this number | |
# of milliseconds | |
This will log any query that runs longer than .5 seconds | |
3) Reload configurations: | |
echo "SELECT pg_reload_conf();" | sudo -u postgres psql | |
4) Now in /var/lib/pgsql/data/pg_log you can tail today's logfile, eg: | |
# tail -f postgresql-Tue.log | |
2016-10-25 11:58:06 EDT LOG: received SIGHUP, reloading configuration files | |
2016-10-25 11:58:17 EDT LOG: received SIGHUP, reloading configuration files | |
2016-10-25 11:58:17 EDT LOG: parameter "log_min_duration_statement" changed to "500" | |
and should start to see queries that take more than .5 seconds show up |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment