Language Element

Introduction

The Language Element “operator” is not actually an operator. It is the name that is given to the top-left operator in an execution plan for any data modification statement. This top-left operator is actually a representation of the client, that fires the query and requests rows, to trigger the actual execution of the execution plan. It is called “StmtSimple” in the execution plan XML.

In an “execution plan only” (without runtime statistics, also known as “estimated plan”), the Language Element “operator” can also be used, by itself and without child operators, as a container for a T-SQL statement that doesn’t need an execution plan, such as assignment (with SET or as part of the DECLARE statement), PRINT, ALTER TABLE, DBCC commands, and many more.

In the execution plan, the Language Element operator is not called “Language Element”, but given the same name as the leading keyword (the first keyword after the Common Table Expression, if any) of the main query, in all caps. So for instance “INSERT” or “MERGE” for a data modification statement, or “ASSIGN”, “DBCC”, “SELECT WITHOUT QUERY”, etc. for simple T-SQL statements.

Queries that have SELECT as their leading keyword do not use the Language Element “operator”, but the Result “operator” (labeled as “SELECT”), which looks different, but has the same function. In an execution plan only, you can also encounter the Cond “operator” for IF and WHILE statements, and the Dynamic, Fetch Query, Keyset, Population Query, and Snapshot “operators” for cursor operations.

Visual appearance in execution plans

Depending on the tool being used, the Language Element “operator” is displayed in a graphical execution plan as shown below:

SSMS and ADS
(current versions)

Legacy SSMS

Plan Explorer

Paste The Plan

Algorithm

When the Language Element “operator” has no child operators, it is a container for a simple statement that doesn’t need an execution plan. The statement is stored in the Statement property of the operator. This usage of the Language Element “operator” is not shown in an execution plan with runtime statistics, but can be seen in the execution plan only (aka “estimated plan”) for statements that don’t have an execution plan.

When the Language Element “operator” does have a child operator, then it is a representation of the client that executes a data modification query and then requests results, by calling the GetNext() method of Result’s child operator. (Note that actual results will only be returned if the data modification uses an OUTPUT clause; otherwise each next requested result will simply result in processing the next row and returning an empty row as confirmation that the request succeeded).

Depending on the code that executes on the client, it may request rows in quick succession and then immediately close the child operator to end execution, or there might be a delay in between GetNext() requests. The application logic also decides whether to continue processing until the end of data is reached, or whether to terminate the query early if no further query results are needed.

Operator properties

Since Language Element is not an actual operator, it does not have its own properties. However, it is used in the execution plan as a container for all properties that apply to the execution plan as a whole. The full list of these properties can be found here.

When Language Element is used as the root operator in an execution plan for data modification, all these properties may appear. When Language Element is used as a container for a statement that has no execution plan, only the Estimated Number of Rows, Estimated Operator Cost, Estimated Subtree Cost, RetrievedFromCache, Statement, and StatementType properties are used.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close