By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,692 Members | 1,998 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,692 IT Pros & Developers. It's quick & easy.

logging queries and time used

P: n/a
Hi.
i would like to log every single query coming in to the database into a
table. i would like the log to include the entire query and execution
time and execution cost, and if possible the user that executed the query.

A trigger is what i was thinking of, but how can i find out the actual
query, the time it took to execute it, etc.?

stig
Nov 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Fri, Oct 29, 2004 at 11:18:48PM +0200, stig erikson wrote:
i would like to log every single query coming in to the database into a
table. i would like the log to include the entire query and execution
time and execution cost, and if possible the user that executed the query.

A trigger is what i was thinking of, but how can i find out the actual
query, the time it took to execute it, etc.?


See the "Error Reporting and Logging" section of the documentation:

http://www.postgresql.org/docs/7.4/s...CONFIG-LOGGING

You might be able to feed the logging output to a script that inserts
into a table, but make sure that important log messages are also
stored outside the database to avoid losing them if trouble arises.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #2

P: n/a
On Fri, Oct 29, 2004 at 11:18:48PM +0200, stig erikson wrote:
i would like to log every single query coming in to the database into a
table. i would like the log to include the entire query and execution
time and execution cost, and if possible the user that executed the query.

A trigger is what i was thinking of, but how can i find out the actual
query, the time it took to execute it, etc.?


See the "Error Reporting and Logging" section of the documentation:

http://www.postgresql.org/docs/7.4/s...CONFIG-LOGGING

You might be able to feed the logging output to a script that inserts
into a table, but make sure that important log messages are also
stored outside the database to avoid losing them if trouble arises.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.