The resource governor works in conjunction with the query optimizer.
When a user issues a request to the server to run a query, the following occurs:
As part of the evaluation, the optimizer predicts or estimates the runtime for the query. This helps determine the best way to access and retrieve the data for the query. In addition, as part of the estimating process, the optimizer also computes the estimated temporary storage usage for the query.
Setting the resource limits for jobs other than the current job
You can set either or both resource limits for a job other than the current job. You do this by using the JOB parameter on the Change Query Attributes (CHGQRYA) command to specify either a query options file library to search (QRYOPTLIB) or a specific QRYTIMLMT, or QRYSTGLMT, or both for that job.
Using the resource limits to balance system resources
After the source job runs the Change Query Attributes (CHGQRYA) command, effects of the governor on the target job is not dependent upon the source job. The query resource limits remain in effect for the duration of the job or user session, or until a resource limit is changed by a Change Query Attributes (CHGQRYA) command. Under program control, a user might be given different limits depending on the application function being performed, the time of day, or the amount of system resources available. This provides a significant amount of flexibility when trying to balance system resources with temporary query requirements.