PostgreSQL: Important Parameters to enable Log for all Queries

I am sharing one of the important topics of PostgreSQL Database Professional.

A database log is necessary for finding different statuses, errors, bad queries and any changes on the Database Server.
A Database Administrator can also log different executed queries and analyze it for performance tuning.

Following are few relevant parameters to enable PostgreSQL log for all queries.

Please open your postgresql.conf file and make sure about all logs related parameter’s value which is mentioned here.

  • log_directory = ‘pg_log’ (default directory name)
  • log_filename = ‘postgresql-%Y-%m-%d_%H%M%S.log’ (default file name structure)
  • log_statement = ‘all’ (value ‘all’ is recommended {none, ddl, mod, all})
  • logging_collector = ON
  • log_line_prefix = ‘%t %c %u ‘ (time, sessionid, user)
  • log_destination = ON (stderr,syslog,csvlog,eventlog)
  • log_rotation_size = 15MB
  • log_rotation_age = 1d (create new log file every day)


Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from dbrnd.com

Sort by:   newest | oldest | most voted
cary
Guest

It’s awesome in support of me to hae a site, which is helpful
in favor of my experience. Thanks admin

eric
Guest

First off I would like to say excellent blog! I had a quick question that I’d like to ask if you do not mind.
I was curious to find out how you center yourself and
clear your mind prior to writing. I have had difficulty clearing my thoughts in getting my
ideas out. I truly do take pleasure in writing but it just
seems like the first 10 to 15 minutes are generally wasted simply just trying to figure out how to begin. Any ideas or hints?
Many thanks!

wpDiscuz