Examples of setting query time limits

To set the query time limit for the current job or user session using query options file QAQQINI, specify QRYOPTLIB parameter on the CHGQRYA command to a user library where the QAQQINI file exists with the parameter set to QUERY_TIME_LIMIT, and the value set to a valid query time limit. For more information on setting the query options file, see Control queries dynamically with the query options file QAQQINI.

To set the query time limit for 45 seconds you would use the following CHGQRYA command:

     CHGQRYA   JOB(*) QRYTIMLMT(45)

This sets the query time limit at 45 seconds. If the user runs a query with an estimated runtime equal to or less than 45 seconds, the query runs without interruption. The time limit remains in effect for the duration of the job or user session, or until the time limit is changed by the CHGQRYA command.

Assume that the query optimizer estimated the runtime for a query as 135 seconds. A message would be sent to the user that stated that the estimated runtime of 135 seconds exceeds the query time limit of 45 seconds.

To set or change the query time limit for a job other than your current job, the CHGQRYA command is run using the JOB parameter. To set the query time limit to 45 seconds for job 123456/USERNAME/JOBNAME you would use the following CHGQRYA command:

     CHGQRYA   JOB(123456/USERNAME/JOBNAME) QRYTIMLMT(45)

This sets the query time limit at 45 seconds for job 123456/USERNAME/JOBNAME. If job 123456/USERNAME/JOBNAME tries to run a query with an estimated runtime equal to or less than 45 seconds the query runs without interruption. If the estimated runtime for the query is greater than 45 seconds, for example 50 seconds, a message would be sent to the user stating that the estimated runtime of 50 seconds exceeds the query time limit of 45 seconds. The time limit remains in effect for the duration of job 123456/USERNAME/JOBNAME, or until the time limit for job 123456/USERNAME/JOBNAME is changed by the CHGQRYA command.

To set or change the query time limit to the QQRYTIMLMT system value, use the following CHGQRYA command:

     CHGQRYA QRYTIMLMT(*SYSVAL)

The QQRYTIMLMT system value is used for duration of the job or user session, or until the time limit is changed by the CHGQRYA command. This is the default behavior for the CHGQRYA command.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]