Reporting query duration - Mailing list pgsql-hackers

From Bruce Momjian
Subject Reporting query duration
Date
Msg-id 200208300327.g7U3RdJ16940@candle.pha.pa.us
Whole thread Raw
Responses Re: Reporting query duration  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [SQL] LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1?
Next
From: Bruce Momjian
Date:
Subject: Remove wal_files