db2top Statements Screen

Queries flowing through a database

Today’s topic is the Statements screen. Unlike the Dynamic SQL screen, the Statements screen lets you see both dynamic and static statements and it groups them by the applications in which they run. As with the Agent screen, you can use this screen to see the operation that a statement is in the middle of, such as a fetch on a cursor and you can also see the name of that cursor. If the statement is static SQL, you can also see the section being executed.

This screen consists of the standard table and no gauges.

The data reported is affected by pressing the ‘G’ key to switch between global and local snapshots. It is also affected by pressing the ‘i’ key to switch between showing all objects and showing only active objects. It is not affected by pressing the ‘k’ key to switch between deltas and actuals and it is not affected by pressing the ‘X’ key to turn on and off extended mode.

db2top Statements Screen
db2top Statements Screen

The table lists statements and the applications executing them and contains the following columns (broken into two screens):

db2top Statements Screen columns 1 to 7

Column Name Definition
Agent Id(State) A system-wide unique ID for the application (agent_id), together with a short code for the current status of the application (appl_status) in parentheses. Possible values for the status are:

c
Database Connect Completed (SQLM_CONNECTED) or
Database Connect Pending (SQLM_CONNECTPEND)
*
Unit of Work Executing (SQLM_UOWEXEC),
Pending remote request (SQLM_WAITFOR_REMOTE), or
Federated request pending (SQLM_REMOTE_RQST)
i
Unit of Work waiting (SQLM_UOWWAIT)
l
Lock Wait (SQLM_LOCKWAIT)
L
Data Fast Load (SQLM_LOAD)
?
All other states

“N/A” is shown (in bold) if there is no agent ID associated with the statement. Also shown in bold text if the state is “*”.

Stmt Num A number to give a unique ID to the statement within the application. It is not dependent upon the order in which the statements were started.
Cpu (Sys+Usr) The total CPU time in seconds used by the statement (stmt_usr_cpu_time + stmt_sys_cpu_time).
Application Name The name of the application (appl_name) running at the client, as known to the database or DB2® Connect™ server. “Unknown” is shown if there is no agent ID associated with the statement.
Application Status The current status of the application (appl_status). Possible values are:

  • Initializing (SQLM_INIT)
  • Connect Pending (SQLM_CONNECTPEND)
  • Connected (SQLM_CONNECTED)
  • UOW Executing (SQLM_UOWEXEC)
  • UOW Waiting in the application (SQLM_UOWWAIT)
  • Lock Waiting (SQLM_LOCKWAIT)
  • Commit Active (SQLM_COMMIT_ACT)
  • Rollback Active (SQLM_ROLLBACK_ACT)
  • Recompiling Plan (SQLM_RECOMP)
  • Compiling SQL Stmt (SQLM_COMP)
  • Request Interupted (SQLM_INTR)
  • Disconnect Pending (SQLM_DISCONNECTPEND)
  • Prepared Transaction (SQLM_TPREP)
  • Trans. heuristically committed (SQLM_THCOMT)
  • Trans. heuristically aborted (SQLM_THABRT)
  • Transaction ended (SQLM_TEND)
  • Creating Database (SQLM_CREATE_DB)
  • Restarting Database (SQLM_RESTART)
  • Restoring Database (SQLM_RESTORE)
  • Backing Up Database (SQLM_BACKUP)
  • Loading Database (SQLM_LOAD)
  • Unloading Database (SQLM_UNLOAD)
  • I/O Error Waiting (SQLM_IOERROR_WAIT)
  • Quiescing a Tablespace (SQLM_QUIESCE_TABLESPACE)
  • Waiting for remote node (SQLM_WAITFOR_REMOTE)
  • Pending results from remote request (SQLM_REMOTE_RQST)
  • Decoupled from coordinator (SQLM_DECOUPLED)
  • Rollback to savepoint (SQLM_ROLLBACK_TO_SAVEPOINT)
  • Unknown[x] where x is the value of an SQLM constant

If the status short code from the Agent Id(State) column is ‘*’, the color is magenta.

If the status short code from the Agent Id(State) column is ‘l’, the color is red.

Statement Start The time when the statement operation started executing (stmt_start).
Statement Stop The time when the statement operation stopped executing (stmt_stop).

db2top Statements Screen columns 8 to 16

Statement Type The type of statement processed (stmt_type). Possible values for the statement type are:

  • Static statement
  • Dynamic statement
  • Non SQL stmt
  • Unknown
Operation Type The statement operation currently being processed (stmt_operation). Possible values for the statement operation are:

  • Prepare
  • Execute
  • Execute Immediate
  • Open
  • Fetch
  • Close
  • Describe
  • Static Commit
  • Static Rollback
  • Free Locator
  • Prepare to Commit
  • Call stored proc
  • Select statement
  • Prep. and open
  • Prep. and exec
  • Compile
  • Set stmt
  • Runstats
  • Reorg
  • Rebind package
  • Redistribute
  • Get Tb Auth.
  • Get Adm Auth.
  • Unknown [x] where x is an operation constant from sqlmon.h
Cursor Name The name of the cursor corresponding to this SQL statement (cursor_name).
Rows Read The number of rows read from tables for the statement (rows_read).
Rows Written This is the number of rows changed (inserted, deleted or updated) in the table for the statement (rows_written).
Sect Nbr The internal section number in the package for a static SQL statement (section_number).
Cost Estimate Estimated cost per partition for the statement, as determined by the SQL compiler (query_cost_estimate). This value is reported in timerons.
Card Estimate An estimate of the number of rows that will be returned per partition by a query (query_card_estimate).
DB User The authorization ID of the user who invoked the application that is being monitored (auth_id).