QUERY_TIMEOUT session environment option

Use the QUERY_TIMEOUT environment option of the SET ENVIRONMENT statement to limit the amount of clock time a query may take before being interrupted internally.

Units of the QUERY_TIMEOUT value are seconds. This setting will not affect DML or DDL statements, or administration operations.

If a query times out, the client will receive SQL error 213 (Statement timed out or interrupted by user) and ISAM error 157 (Interrupted ISAM call).

The SET ENVIRONMENT QUERY_TIMEOUT statement of SQL supports the following syntax:


1  0
1  - integer
Element Description Restrictions Syntax
integer Nonnegative integer that defines the maximum clock time a query is allowed Must be in the range 1 ≤ integer ≤ 10000 Quoted String


The QUERY_TIMEOUT session environment option can have the following values:
  • '0' or "0"

    Disables the timeout for the current session.

  • 'integer' or "integer" where 1 ≤ integer ≤ 10000

    Enables the query timeout for the current session and triggers an interrupt of any query that runs longer than integer seconds. Note that the query run time is evaluated based on clock time, not the cumulative time the session’s threads spend running on a VP.

    It is not possible to set an instance-wide query timeout for all sessions. Each individual session must configure its own timeout.