Database Research & Development

  • Home
  • NoSQL
    • NoSQL
    • Cassandra
  • Databases
    • Database Theory
    • Database Designing
    • SQL Server Coding Standards
    • SQL Server
    • PostgreSQL
    • MySQL
    • Greenplum
    • Linux
  • Interviews
    • SQL Server Interviews
    • MySQL Interviews
    • SQL Puzzles
  • DBA Scripts
    • SQL Server DBA Scripts
    • PostgreSQL DBA Scripts
    • MySQL DBA Scripts
    • Greenplum DBA Scripts
  • Home
  • Blog Archives !
  • (: Laugh@dbrnd :)
  • Contact Me !
sqlserverinterviews
Home 2015 November PostgreSQL: Important Parameters to enable Log for all Queries

PostgreSQL: Important Parameters to enable Log for all Queries

This article is half-done without your Comment! *** Please share your thoughts via Comment ***

In this post, I am sharing an important topic for 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 those for performance tuning.

Following are few relevant parameters for enabling the PostgreSQL log for all the queries.

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

  • 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)
Nov 12, 2015Anvesh Patel
SQL Server: Script to find total Row Count of All Tables in a DatabaseSQL Server: Script to find CPU Pressure using Signal Wait Time
Comments: 5
  1. cary
    December 6, 2015 at 5:36 pm

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

  2. eric
    January 17, 2016 at 12:06 pm

    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!

  3. Venkat
    August 23, 2017 at 4:16 am

    Nice article.log_statement is for taking the all log statements, but I need to restrict ddl commands on the particular tables.please share your ideas.
    Thanks
    Venkat.

  4. Ankit Kapoor
    May 16, 2018 at 5:04 pm

    please contact me . We can discuss open source future and issues. I am into same field.

  5. Anvesh Patel
    May 25, 2018 at 6:29 am

    Sure Ankit,
    Thank you…

Anvesh Patel

Database Engineer

November 12, 2015 PostgreSQL, PostgreSQL DBA ScriptAnvesh Patel, database, database research and development, dbrnd, log_statement, logging_collector, plpgsql, Postgres Query, postgresql, PostgreSQL Administrator, PostgreSQL Error, PostgreSQL Programming, PostgreSQL Tips and Tricks, postgresql.conf
About Me!

I'm Anvesh Patel, a Database Engineer certified by Oracle and IBM. I'm working as a Database Architect, Database Optimizer, Database Administrator, Database Developer. Providing the best articles and solutions for different problems in the best manner through my blogs is my passion. I have more than six years of experience with various RDBMS products like MSSQL Server, PostgreSQL, MySQL, Greenplum and currently learning and doing research on BIGData and NoSQL technology. -- Hyderabad, India.

About DBRND !

dbrnd

This is a personal blog (www.dbrnd.com).

Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity, unless explicitly stated.

Feel free to challenge me, disagree with me, or tell me I’m completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever (abusive, profane, rude, or anonymous comments) - so keep it polite.

The content of this website is protected by copyright. No portion of this website may be copied or replicated in any form without the written consent of the website owner.

Recent Comments !
  • Anvesh Patel { Sure will do... } – May 27, 12:43 PM
  • Anvesh Patel { Great... } – May 27, 12:41 PM
  • Anvesh Patel { Great... } – May 27, 12:39 PM
  • Anvesh Patel { Great... } – May 27, 12:36 PM
  • Anvesh Patel { Great... } – May 27, 12:28 PM
  • Anvesh Patel { Great... } – May 27, 12:27 PM
  • Anvesh Patel { Great... } – May 27, 12:16 PM
  • Older »
Follow Me !
  • facebook
  • linkedin
  • twitter
  • youtube
  • google
  • flickr
© 2015 – 2019 All rights reserved. Database Research & Development (dbrnd.com)
Posting....