Reporting query duration

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Reporting query duration
Date: 2002-08-30 03:27:39
Message-ID: 200208300327.g7U3RdJ16940@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

There is a TODO item:

* Allow logging of query durations

Currently there is no easy way to get a list of query durations in the
server log file. My idea is to add query duration to the end of the
query string for 'debug_print_query'. My only problem is that to print
the duration, I would have to print the query _after_ it is executed,
rather than before. This may make it difficult to look at the server
logs to see what queries are running, plus if the query errors, I have
to still print it, I assume, though actually Gavin's new GUC option will
add printing of error queries, so I may be OK to just print the
successful ones.

I imagine this timing would be used by administrators to find out which
queries where slow.

Comments?

Also, looking at the GUC options:

#debug_print_query = false
#debug_print_parse = false
#debug_print_rewritten = false
#debug_print_plan = false
#debug_pretty_print = false

I notice Peter is correct that debug_print_query really is a log_*
option, rather than a debug option. The others are for server
debugging, while debug_print_query is more of a log queries option.
Should we rename it and support both log_print_query and
debug_print_query for one release?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-08-30 03:47:36 Remove wal_files
Previous Message Bruce Momjian 2002-08-30 03:18:58 Re: [SQL] LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1?