IBM Books

DB2 Query Patroller Administration Guide


Introduction

This part of the book provides information and procedures for running and maintaining the DB2 Query Patroller system. The following chapter provides an overview of the system and its components, and gives you a step by step explanation of how DB2 Query Patroller handles and processes jobs.


Syntax Conventions

This book uses syntax diagrams as well as the syntax parameters described in the table below. Consider parameters in the table to be case sensitive unless the description of the parameter states otherwise.

Table 2. Syntax Conventions
Convention Description
{ } Brace brackets contain multiple choices separated by the pipe (|) symbol. You can only select one of the values within the brace brackets. For example, the syntax {yes | no} indicates that you can select either the yes or no value, but not both.
| The pipe symbol separates multiple choices found within brace brackets.
[ ] Square brackets contain optional parameters.
Italics Italics are used to note a variable parameter that is acting as a place holder. You must replace it with a specific value when you issue the command. For example, node_id represents a variable for the node ID; you must supply a specific node ID when you enter the command.
... An ellipsis indicates that the previous value may be repeated.


DB2 Query Patroller Components

The DB2 Query Patroller system consists of the DB2 Query Patroller server system, the system administrator's workstation, and client PCs. The diagram below illustrates the architecture of the DB2 Query Patroller system and the product components on each platform:
DB2 Query Patroller System Architecture

DB2 Query Patroller consists of the following components:

Server

The server executes on a single database node. The server accepts, analyzes, prioritizes, and schedules database requests and optionally notifies users when their requests have been processed.

The server consists of the following software components:

Agent

The agent executes on one or more database nodes and processes database requests. On a single-processor or non-clustered SMP machine, the agent and server components run on the same machine. On an MPP machine, or clustered SMP machines, the server component runs on one node and the agent(s) may run on several nodes, including the same node as the server component.

The DB2 Query Patroller agent consists of the following software components:

Command-Line Interface

The command-line interface enables the system administrator to monitor and control DB2 Query Patroller from a command-line prompt. This feature also enables you to submit and monitor jobs from the command line. When combined with shell scripts or languages such as Perl, awk, and REXX, you can use the command-line interface as an application programming interface (API) to DB2 Query Patroller.

QueryAdministrator

QueryAdministrator provides an interface for administering the DB2 Query Patroller system. QueryAdministrator is a Java application that runs on Windows 32-bit operating systems.

QueryAdministrator enables the system administrator to manage the DB2 Query Patroller system parameters, create or delete profiles for DB2 Query Patroller users, manage nodes, result destinations, data sources and job queues.

Tracker

The Tracker utility provides reports that display a database usage history for queries that have been managed by the DB2 Query Patroller system. For example, Tracker allows you to determine which tables and columns have been accessed most frequently, which tables have returned the most result rows, and which jobs have been completed within a specific time period.

QueryEnabler

QueryEnabler places queries submitted through an ODBC-compliant query tool under the management of the DB2 Query Patroller system. With QueryEnabler, you can wait for the results to return, or you can have the results returned at a later time. This frees your workstation to submit other queries or perform other work. QueryEnabler runs on Windows 32-bit operating systems.

QueryMonitor

QueryMonitor provides an interface for monitoring queries that have been submitted to the DB2 Query Patroller system. QueryMonitor is a Java application that runs on Windows 32-bit operating systems.

QueryMonitor enables the user to monitor query status, view job details, cancel jobs, submit new jobs, drop result tables, and resubmit completed jobs.


DB2 Query Patroller Tables

The following list explains the tables used by DB2 Query Patroller. The DB2 Query Patroller installation creates these tables in the database.


Connections

The various DB2 Query Patroller components communicate with each other through either the DB2 Query Patroller tables or socket connections. All of the Windows-based components communicate with DB2 Query Patroller through the DB2 Query Patroller tables. The command-line interface, agent component, and some parts of the server component communicate with the DB2 Query Patroller request server through sockets. To reduce the number of TCP socket connections required, the iwm_net process runs on the server node and on the agent nodes. The iwm_net processes enable the processes on one node to communicate with each other using TCP/IP sockets and concentrate all communication between nodes to a single outgoing socket connection.


Job Flow

This section describes the flow of a job from the time a query is submitted to DB2 Query Patroller until the time that notification of job completion is received.

  1. Job Submission

    Queries are typically submitted with 32-bit ODBC query applications. QueryEnabler intercepts these queries and, with user intervention, submits the query to DB2 Query Patroller as a job. Jobs can also be submitted through QueryMonitor and the command-line interface. When you submit a job, the DB2 Query Patroller component used to submit the job saves the SQL statement, along with the user ID, date and time the job is scheduled to be run, and the maximum cost permitted. The User Profile information provides the maximum cost. The component used to submit the job also adds this information to the Job table and assigns a job number.

  2. Cost Analysis

    After a user submits a job to DB2 Query Patroller, the server component estimates the cost to execute the query. The server component uses the cost estimate from DB2.

    If the computed cost is greater than the maximum cost (obtained from the User Profile when the user submitted the job), the job is put on hold. Otherwise, the job runs as soon as the scheduled date and time passes and sufficient system resources are available. If the job is on hold, the DB2 Query Patroller system administrator must release or cancel the job. For jobs submitted through the command-line interface, cost analysis is performed as part of job submission, not as a separate step.

  3. Job Scheduling

    The server component's job scheduler activates periodically to scan for new jobs to be run. It processes jobs that are ready to run in order of priority. Jobs of equal priority are processed in the order that they were submitted. To determine if a job can run, the scheduler looks to see if the number of queries already running has reached the limit set in the User Profile. The scheduler also looks to see if the total number of queries running or the cost of the new job plus the total cost of any running jobs has reached the limits set for the data source and the system. Next, based on the job's cost, the scheduler checks for an associated job queue and determines the limit on the number of jobs for the queue. If a job cannot be scheduled due to system limits, the scheduler bypasses the job and processes the next ready job. The scheduler processes any jobs skipped during a scheduling cycle the next time it activates.

    If a job can be scheduled, it must be assigned to a node. The job scheduler selects a node based on the limits set for the data source and on the CPU and disk-utilization statistics being gathered by the node managers. The node selected is the one with the fewest number of assigned jobs. If two or more nodes are running the same number of jobs, the job scheduler selects the node with the lowest CPU utilization.

  4. Job Execution

    The node manager of each agent activates periodically to scan for new jobs scheduled to be run on that node. (For more information, see DB2 Query Patroller Components.) The node manager creates a new process for each job to run the executor. Normally, for a job containing a SQL SELECT statement, the executor component opens a cursor to fetch the result rows. When the database returns the first row, DB2 Query Patroller creates the result table. The executor component uses an insert cursor to efficiently create the result table. When each job completes, the executor component sends the completion status and execution statistics back to the server component to be recorded in the job table.

    In addition to running jobs newly scheduled for the node, each time the node manager activates it also collects CPU and disk utilization statistics and checks for jobs to be canceled or that have aborted. Jobs may be canceled any time from submission until they have been scheduled. Database connections for running jobs are removed when a job is canceled.

  5. Notification

    The server component's notifier activates periodically to scan for jobs that complete successfully or unsuccessfully, or for any jobs with a held status. This component notifies users of these events through e-mail and adds a row to the Job Accounting table for each completed job when the job accounting status is active. The notifier component also purges expired job table entries and result tables.


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

[ DB2 List of Books | Search the DB2 Books ]