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 » Database performance monitoring

SQL functions used to monitor statistics

A set of system functions that can provide data on a per-connection, per-database, or server-wide basis is provided.

The kind of information available ranges from static information (such as the database server name) to detailed performance-related statistics (such as disk and memory usage).

Functions that retrieve system information

The following functions retrieve system information:

  • PROPERTY function

    This function provides the value of a given property on a server-wide basis.

  • DB_PROPERTY and DB_EXTENDED_PROPERTY functions

    These functions provide the value of a given property for a given database, or by default, for the current database.

  • CONNECTION_PROPERTY and CONNECTION_EXTENDED_PROPERTY functions

    These functions provide the value of a given property for a given connection, or by default, for the current connection.

Supply as an argument only the name of the property you want to retrieve. The functions return the value for the current server, connection, or database.

Improving query efficiency

For better performance, a client application monitoring database activity should use the PROPERTY_NUMBER function to identify a named property, and then use the number to repeatedly retrieve the statistic.

Property names obtained in this way are available for many different database statistics, from the number of transaction log page write operations and the number of checkpoints performed, to the number of reads of index leaf pages from the memory cache.

The following set of statements illustrates the process from Interactive SQL:

CREATE VARIABLE propnum INT;
CREATE VARIABLE propval INT;
SET propnum = PROPERTY_NUMBER( 'CacheRead' );
SET propval = DB_PROPERTY( propnum );

Example

The following statement sets a variable named server_name to the name of the current server:

SET server_name = PROPERTY( 'name' );

The following query returns the user ID for the current connection:

SELECT CONNECTION_PROPERTY( 'UserID' );

The following query returns the file name for the root file of the current database:

SELECT DB_PROPERTY( 'file' );