SQL Query Logging

The SQL Log page shows the most recent queries received by the account database, with some context information for each.

The logging is enabled by default, and can be disabled and re-enabled on demand from the Logging Manager page. Disabling the logging removes all query log records.

Summary Page

The log shows a summary page similar to this. Some elements of each entry may be truncated for list display.

When errors occur, those are represented in the log.

Clicking on the 'expand display' link will expand the display for that query log record, to include the full query (with scroll bars, as required) and all arguments, as below:

Log Maintenance

The log is trimmed to under 100 queries, in the default configuration. You can override the monitor.cleanup_sql_log function to replace it with your own preferred trimming functionality. This is not a trigger, as we try to leave PL/pgSQL optional, and plain SQL functions cannot be triggers. It is, instead, a plain old SQL function called by the RdbHost runtime. If you remove it, the cleanup will just fail silently. Disabling and re-enabling logging will serve to restore the lost cleanup function.

The log table is called 'sqllog', and is kept in a schema called 'monitor' in your account database. You can use queries, either from RdbAdmin or from your choice of clients to manipulate the log entries or do statistics as you wish. You can even disable trimming and allow queries to accumulate forever. The log is in your account though, so it is billable space usage.

Log Entry Elements

The elements of each query entry in the log are listed and described here: