You are here: Reference Information > SQL Reference Information > SQL System Tables > QUERYSTATS System Table Description

QUERYSTATS System Table Description

Description

A pseudo table generated to show long running queries that have completed. (Currently running queries would be visible in SYSTEM.CONNECTIONS - see CONNECTIONS System Table Description.) SYSTEM.QUERYSTATS is also referred to as the Slow Query Log. By default, the ten slowest queries that took more than ten seconds to execute are stored in SYSTEM.QUERYSTATS. These defaults are configurable with the MAX_QUERY_COUNT and MIN_QUERY_TIME settings, respectively, in SYSTEM.PROPERTIES (see PROPERTIES System Table Description). See Improving Query Performance for more information.

Fields

The fields in SYSTEM.QUERYSTATS are very similar to the fields in SYSTEM.CONNECTIONS.

Field Type Description
SQLSTRING string The SQL statement that ran slowly.
COUNT integer A number n, indicating that this statement was the nth statement executed by the connected client.
RUNTIME bigint The duration of the statement execution specified in microseconds
USER string The SQL user for the database connection.
SCHEMA string The current SQL schema for the connection at the time of invocation of the slow query.
NUMPARAM integer The number of SQL parameters specified in the query. This is 0 if no parameters were specified.
PARAMS string

A string representing the parameters specified in the query. The string representing each parameter is of the format:

n/type/value

Where:

n

The number of the parameter starting at 0

type

The type of the variable, i.e. integer, string, etc.

value

The value passed in to the parameter.

Each parameter string is separated by a space.
An example:

NUMPARAM            PARAMS 
--------- ---------------------------- 
    2     0/string/'hello' 1/integer/3
NODEID integer A unique identifier specifying to which NuoDB transaction engine the slow query's client was connected.
NROWS integer The number of rows in the result set returned by the slow query, if any.
TIMESTAMP string The timestamp when the slow query began.
EXPLAIN string The EXPLAIN string for the slow query. See EXPLAIN for more information.

Indexes

None