Provides the history of the query plans for recently executed queries.
monSysPlanText returns one row of text from each line of the running query plans (similar to what is returned sp_showplan or by set showplan on). To make sure monSysPlanText reads the query plan text in the correct sequence, order the query result by SequenceNumber. For queries returning data for multiple queries or processes, order the query result by SPID, KPID, BatchID, SequenceNumber.
Enable the enable monitoring, plan text pipe active, and plan text pipe max messages configuration parameters for this monitoring table to collect data.
monSysPlanText is a historical monitoring table. See “Stateful historical monitoring tables”.
Name |
Datatype |
Attributes |
Description |
---|---|---|---|
PlanID |
int |
Unique identifier for the plan |
|
SPID |
smallint |
Session process identifier |
|
KPID |
int |
Kernel process identifier |
|
BatchID |
int |
Unique identifier for the SQL batch for which the plan was created |
|
ContextID |
int |
The stack frame of the procedure, if a procedure |
|
SequenceNumber |
int |
A monotonically increasing number indicating the position of the PlanText column within the entire plan text |
|
DBID |
int |
Unique identifier for the database where the procedure is stored, if the plan is for a stored procedure |
|
ProcedureID |
int |
Unique identifier for the procedure, if the plan is for a stored procedure |
|
PlanText |
varchar(160) |
Null |
Plan text output |
Typically, there are multiple rows in this table for each query plan. Arrange the rows by sorting on the SequenceNumber column in ascending order.