Tags

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,


What are the internal methods of Physical Operators? How they work?

Download PDF- Methods of Physical Operators

All the operators present in the execution plan are physical operators. We can see the physical operation by hovering over each operator in the execution plan.

Physical Operators 1

Picture above showing example of physical operators in an execution plan

Physical Operators 2

For example- Picture showing how each operator requests rows and how rows are returned. Please note that each operator asks for a row one at a time. So works like one record come at a time and goes out at a time.

All operators used in execution plans, implement three methods. They are
1. Init()
2. GetNext()
3. Close()

Init() method-

This is the first method for each physical operator.

It does following steps.
a. It initializes the physical operator.
b. It sets up the required data structures.
c. Some operators can receive more than one input, so, these inputs will be processed at the Init() method. The concatenation is one example of these operators.

GenNext() method-

a. This operator requests next record
b. It can have zero or more rows
c. It is responsible for setting Actual Rows property in the execution plan. Example below-

Physical Operators 3

Close() method-

a. It is called once for each physical operator. It cleans up the things and shut down the operator.

Summary

So all in all what we have each operator asks for a row from his next operator and sucks it through. It works from left to right and the data flows from right to left.

That’s all folks; I hope you’ve enjoyed learning about physical operators and their internal methods, and I’ll see you soon with more “Performance Tuning” articles.

Thanks!

Pawan Kumar Khowal

MSBISKills.com

Advertisements