Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - Database Administration » Performance improvements, diagnostics, and monitoring » Diagnostics » Other diagnostic tools and techniques

Request logging

Request logging logs individual requests received from, and responses sent to, an application.

It is most useful for determining what the database server is being asked to do by the application.

Request logging is also a good starting point for performance analysis of a specific application when it is not obvious whether the database server or the client is at fault. You can use request logging to determine the specific request to the database server that might be responsible for problems.

Note All the functionality and data provided by the request logging feature is also available using diagnostic tracing. Diagnostic tracing also offers additional features and data.

Logged information includes such things as timestamps, connection IDs, and request type. For queries, it also includes the isolation level, number of rows fetched, and cursor type. For INSERT, UPDATE, and DELETE statements, it also includes the number of rows affected and number of triggers fired.

Note The request log can contain statements with obfuscated sensitive information. If you store passwords or keys in plain text to the server, then that information is logged. The only case when sensitive information is not obfuscated is a statement with a parsing error.

You can use the -zr server option to turn on request logging when you start the database server. You can redirect the output to a request log file for further analysis using the -zo server option. The -zn and -zs option let you specify the number of request log files that are saved and the maximum size of request log files. Additionally, you can use the sa_server_option system procedure to set up request logging on a server that is already running.

Note These server options do not impact diagnostic tracing in SQL Central. File-based request logging is completely separate from the diagnostic tracing feature in SQL Central, which makes use of dbo-owned diagnostic tables in the database to store request log information.

The sa_get_request_times system procedure reads a request log and populates a global temporary table (SATMP_request_time) with statements from the log and their execution times. For INSERT/UPDATE/DELETE statements, the time recorded is the time when the statements were executed. For queries, the time recorded is the total elapsed time from PREPARE to DROP (describe/open/fetch/close). Request times are not provided for cursors that are still open.

Analyze SATMP_request_time for statements that could be candidates for improvements. Statements that are inexpensive, but frequently executed, may represent performance problems.

You can use sa_get_request_profile to call sa_get_request_times and summarize SATMP_request_time into another global temporary table called SATMP_request_profile. This procedure also groups statements together and provides the number of calls, execution times, and so on.


If the log is being analyzed using the Perl script, the max_client_statements_cached option should be set to 0 to disable client statement caching while the request log is captured.


Output to the request log can be filtered to include only requests from a specific connection or from a specific database, using the sa_server_option system procedure. This can help reduce the size of the log when monitoring a database server with many active connections or multiple databases.

To filter according to a connection:

CALL sa_server_option( 'RequestFilterConn' , connection-id );

You can obtain connection-id by executing CALL sa_conn_info( ).

To filter according to a database:

CALL sa_server_option( 'RequestFilterDB' , database-id );

The database-id can be obtained by executing SELECT CONNECTION_PROPERTY( 'DBNumber' ) when connected to that database. Filtering continues until explicitly reset, or until the database server is shut down.

To reset filtering, use either of the following two statements to reset filtering either by connection or by database:

CALL sa_server_option( 'RequestFilterConn' , -1 );
CALL sa_server_option( 'RequestFilterDB' , -1 );

To include host variable values in the request log:

  • use the -zr server option with a value of hostvars

  • execute the following:

    CALL sa_server_option( 'RequestLogging' , 'hostvars' );

The request log analysis procedure, sa_get_request_times, recognizes host variables in the log and adds them to the global temporary table SATMP_request_hostvar.