MonitorSQLCurrentStepSV - Teradata VantageCloud Lake

Lake - Monitor Resources and Performance

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
wyu1683671641248.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
wyu1683671641248

Use this single operational view API for the SQL step being run on the currently running request across VantageCloud Lake clusters. You can then use this function to get additional details on that session to monitor the current SQL step for the SQL run, if that session that is running a query.

Syntax

REPLACE FUNCTION SYSLIB.MonitorSQLCurrentStepSV (
  HostIdIn SMALLINT,
  SessionNoIn INTEGER,
  RunVprocNo SMALLINT
) RETURNS TABLE (
    HostId SMALLINT,
    SessionNo INTEGER,
    DynamicPlan  SMALLINT
    PartialSteps SMALLINT,
    NumOfSteps SMALLINT,
    CurLvl1StepNo SMALLINT,
    CurLvl2StepNo SMALLINT
    ZoneID INTEGER,
    SPName VARCHAR(128) CHARACTER SET UNICODE,
    SPDBName VARCHAR(128) CHARACTER SET UNICODE,
    DefaultDBName VARCHAR(128) CHARACTER SET UNICODE,
    ParentSessionNo INTEGER,
    Type VARCHAR,
    Id VARCHAR,
    Name VARCHAR,
    Group VARCHAR
  )
  ...
;

Syntax Elements

HostIdIn
Logical ID of a host (or client) with sessions logged on.
A value of -1 indicates all hosts.
SessionNoIn
Session number of the SQL to monitor.
RunVprocNo
PE vproc number where the session runs.
HostId
This value is incremented by 10000 for each compute cluster for the single view. For example, the first node of the primary cluster starts at 1, the first node of the first online compute cluster starts at 10001, and the first node of the second online compute cluster starts with 20001, and so on.
SessionNo
Number of the current session. With a given host ID, a session number uniquely identifies a session on the database system. This value is assigned by the host (or client) at logon time.
DynamicPlan
Plan type:
  • 0 = Static plan
  • 1 = Dynamic plan
PartialSteps
Possible values:
  • 0 = All steps are returned
  • 1 = Partial plan or no plan is returned

    If a partial plan is returned, this indicates the steps for the final plan fragment of the dynamic explanation of the request has not yet been generated.

    If no plan is returned, this indicates the request has been throttled and is in the delay queue.

A value 1 cannot occur for a static plan.
NumOfSteps
Number of steps in the description text in the third statement of the response.
Plan DynamicPlan Field Value PartialSteps Field Value NumOfSteps
Static 0   Number of steps for plan.
Complete dynamic 1 0 Number of steps for plan.
Partial dynamic 1 1 Number of steps generated.
If a request with a partial dynamic plan has been throttled and is in the delay queue (that is, no rows are returned in response to the third statement), NumOfSteps is zero.
For more information, see DynamicPlan and PartialSteps fields in MONITOR SQL.
CurLvl1StepNo
Number of the running level 1 step. If parallel steps are running, this is the number of the lowest running step.
If this is a request with a dynamic plan that has been throttled and is in the delay queue (for example, when the NumOfSteps field value is zero and both the DynamicPlan are PartialSteps field values are 1), the CurLvl1StepNo field value is zero.
CurLvl2StepNo
Number of the running step. If parallel steps are running, this is the number of the highest running step. If only one step is running, CurLvl1StepNo and CurLvl2StepNo are identical.
If this is a request with a dynamic plan that has been throttled and is in the delay queue (for example, when the NumOfSteps field value is zero and both the DynamicPlan are PartialSteps field values are 1), the CurLvl2StepNo field value is 1.
If only one step is executing, CurLvl1StepNo and CurLvl2StepNo are identical.
ZoneId
The unique identifier of the zone.
SPName
The outer stored procedure name, if a stored procedure is running.
NULL is returned in indicator mode if no stored procedure is running.
SPDName
This is the owner database name of the outer stored procedure if a stored procedure is running.
NULL is returned in indicator mode if no stored procedure is running.
DefaultDBName
This field returns the default database name of the session at the start of the non-stored procedure request. For stored procedures, this field returns the default database name of the session when the stored procedure was compiled.
ParentSessionNo
Only available in the detailed view and for compute clusters. This integer links the query running from the primary cluster to the compute cluster. The Parent Session is the session from the primary cluster that correlates to this SessionNo from the compute cluster.
Type
Only available in the detailed view. Identifies the group type (compute cluster or primary cluster).
Id
Only available in the detailed view. Provides the TOS identifier the of the group (useful to identify compute clusters).
Name
Only available in the detailed view. Provides the name of the compute cluster.
Group
Only available in the detailed view. Provides the name of the compute group.

Usage Notes

If MONITOR SQL processing is not completed within the timeout interval, then an error is returned to the client application. When a MONITOR SQL request is timed out, the processing continues internally to its completion. If the client application submits a new MONITOR SQL request for the same timed out target session while the previous timed out one is still being processed, then an error is returned.

For information on MONITOR SQL, see MONITOR SQL.