INFORMATION.SCHEMA.CURRENTSTATEMENTS
Class INFORMATION.SCHEMA.CURRENTSTATEMENTS Extends (%Library.Persistent, %XML.Adaptor) [ ClassType = persistent, Final, Owner = {_PUBLIC}, SqlRowIdPrivate, SqlTableName = CURRENT_STATEMENTS, StorageStrategy = SQLStorage, System = 4 ]
Returns one row for each metadata string pushed onto the Application Metadata Stack (AMS) that belongs to the SQL application (ApplicationID="%SQL" [WHERE "%SQL"=$$$AMSApplicationIDSQL]). The GetStackInfo method within the %SYS.AppMetadataStack.SQL class returns the data ResultSet for this class/table.
Parameters
READONLY
Parameter READONLY = 1;
Properties
AppMetadataStackID
Property AppMetadataStackID As %List [ SqlColumnNumber = 2 ];
MRP1317
The first $LIST(...) element of the Application Metadata Stack's (AMS) metadata string, which is itself a $LIST(...) string that is comprised of two or more elements that can be used to uniquely identify the metadata string of the application that pushed this information onto the AMS
ApplicationID
Property ApplicationID As %String [ InitialExpression = {$$$AMSApplicationIDSQL}, Private, Required, SqlColumnNumber = 3, SqlFieldName = ApplicationID ];
MRP1310 [Major Refactoring]
The first element of the AppMetadataStackID property, which identifies the application that pushed this information onto the Application Metadata Stack (AMS)
SQLStatementID
Property SQLStatementID As %Integer [ SqlColumnNumber = 4 ];
The second element of the AppMetadataStackID property, which is a unique SQL Statement Identifier that can be used to identify a SQL Statement that is stored in the SQL Statement Index (SSI)
Server
Property Server As %String [ Required, SqlColumnNumber = 5 ];
Identifies the instance on which this SQL Statement is running: :
ProcessId
Property ProcessId As %String [ Required, SqlColumnNumber = 6, SqlFieldName = ProcessID ];
Identifies the IRIS process ($JOB) in which this SQL Statement is running
StatementIndexHash
Property StatementIndexHash As %String [ Required, SqlColumnNumber = 7 ];
SQL StatementIndex hash of this SQL Statement, which is used as a pointer to the internal definition stored in the SQL Statement Index (SSI)
UserName
Property UserName As %String [ Required, SqlColumnNumber = 8 ];
$USERNAME of person who created and invoked this SQL Statement
QueryRunType
Property QueryRunType As %String [ Required, SqlColumnNumber = 9 ];
SQL Query Run Type of this SQL Statement: EmbeddedSQL | DynamicSQL | xDBCQuery | ...
QueryStmtType
Property QueryStmtType As %Integer [ Required, SqlColumnNumber = 10 ];
SQL Query Statement Type # of this SQL Statement: 1 = SELECT | 2 = INSERT | 3 = UPDATE | 4 = DELETE | ... | 72 = CANCEL QUERY
TPNestingLevel
Property TPNestingLevel As %Integer [ Required, SqlColumnNumber = 11, SqlFieldName = TP_NestingLevel ];
Current nesting level for Transaction Processing (TP)
Parameters
Property Parameters As %List [ SqlColumnNumber = 12 ];
First 10 SQL Statement parameters (might be truncated)
NameSpace
Property NameSpace As %String [ Required, SqlColumnNumber = 13, SqlFieldName = Namespace ];
Namespace in which this SQL Statement was built/compiled into a Cached Query and invoked
CachedQuery
Property CachedQuery As %String [ SqlColumnNumber = 14 ];
Name of the Cached Query class created for this SQL Statement NOTE: For some Embedded SQL DDL Statements, this will be the name of the Class/Routine in which the Embedded SQL DDL Statement is specified and code generated
CallerName
Property CallerName As %String [ SqlColumnNumber = 15 ];
Name of the Routine/Class who called this SQL Statement If this is the top-most SQL Statement, then this value will be the empty string ("")
StatementOrder
Property StatementOrder As %Integer [ Required, SqlColumnNumber = 16 ];
Order in which this SQL Statement is being executed, based on the ^||oddSQL.CURRENTSTATEMENTS("orderStmts") $LIST(...)
CurrentWorkerCount
Property CurrentWorkerCount As %Integer [ SqlColumnNumber = 17 ];
Number of workers currently active on behalf of this SQL Statement
ExecutionStart
Property ExecutionStart As %TimeStamp [ Required, SqlColumnNumber = 18 ];
Timestamp when this SQL Query started executing (in local timezone)
ExecutionStartUTC
Property ExecutionStartUTC As %TimeStamp [ Required, SqlColumnNumber = 19 ];
UTC timestamp when this SQL Query started executing
ExecutionDuration
Property ExecutionDuration As %Numeric(SCALE = 6) [ Required, SqlColumnNumber = 20 ];
Amount of time (in seconds) in which this SQL Query has been executing
ParentType
Property ParentType As %String [ SqlColumnNumber = 21 ];
Parent Type: Parallel, Sharded
ChildStatements
Property ChildStatements As %List [ SqlColumnNumber = 22 ];
$LIST(...) of {StatementIndexHash} for all Children Queries
Status
Property Status As %String [ Calculated, Required, SqlColumnNumber = 23, SqlComputeCode = { set {*}="Executing"}, SqlComputed ];
SQL Query Status: Preparing, Executing (Current Default), Closed, Aborted - or more fine-grained
Parent
Relationship Parent As INFORMATION.SCHEMA.CURRENTSTATEMENTS [ Cardinality = one, Inverse = SubStatement ];
SubStatement
Relationship SubStatement As INFORMATION.SCHEMA.CURRENTSTATEMENTS [ Cardinality = many, Inverse = Parent ];
Methods
GetSQLStatement
ClassMethod GetSQLStatement(ns As %String = "", hash As %String = "", Output tSC = "", normalize As %Boolean = 1, upper As %Boolean = 0) As %String [ SqlName = GetSQLStatement, SqlProc ]
Get and return the SQL Statement Text based on the {NameSpace} & {StatementIndexHash} fields NOTE: Users with "USE" permission on the %Development resource can get all SQL Statements