Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8601155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:46:40+00:00 2026-06-12T01:46:40+00:00

I want to log each query execution time which is run in a day.

  • 0

I want to log each query execution time which is run in a day.

For example like this,

2012-10-01 13:23:38 STATEMENT: SELECT * FROM pg_stat_database  runtime:265 ms.

Please give me some guideline.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T01:46:41+00:00Added an answer on June 12, 2026 at 1:46 am

    If you set

    log_min_duration_statement = 0
    log_statement = all 
    

    in your postgresql.conf, then you will see all statements being logged into the Postgres logfile.

    If you enable

    log_duration
    

    that will also print the time taken for each statement. This is off by default.

    Using the log_statement parameter you can control which type of statement you want to log (DDL, DML, …)

    This will produce an output like this in the logfile:

    2012-10-01 13:00:43 CEST postgres LOG:  statement: select count(*) from pg_class;
    2012-10-01 13:00:43 CEST postgres LOG:  duration: 47.000 ms
    

    More details in the manual:

    • http://www.postgresql.org/docs/8.4/static/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHEN
    • http://www.postgresql.org/docs/8.4/static/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHAT

    If you want a daily list, you probably want to configure the logfile to rotate on a daily basis. Again this is described in the manual.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to log my query times for each time when a query made.
i need to log each method call in my application. i dont want to
I'm writing log statements to a file and want to prepend each line with
I have an object which I want to filter. This is what I use:
I have this query. SELECT purchase_log.id, purchase_log.date_purchased, purchase_log.total_cost, purchase_log.payment_status, cart_contents.product_name, members.first_name, members.last_name, members.email FROM
Hey guys, I have this query. SELECT COUNT(purchase_log.id), purchase_log.date_purchased, purchase_log.total_cost, purchase_log.payment_status, cart_contents.product_name, members.first_name, members.last_name,
In a trigger I want to see what sql query triggered this trigger. I
For each distinct Name, I want to select the first three rows with the
This example validates urls correctly. How can I identify which one(s) didn't validate? I
I want to run a query to get a string array of distinct logName

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.