30.06.2013 Views

SQL Server Execution Plans - Red Gate Software

SQL Server Execution Plans - Red Gate Software

SQL Server Execution Plans - Red Gate Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 2: Graphical <strong>Execution</strong> <strong>Plans</strong> for Basic Queries<br />

Most of the time in this chapter, the value for both the rebinds and rewinds has been<br />

zero, but for the Sort operator example, a little earlier, we saw that there was one actual<br />

rebind and zero actual rewinds. Figure 2.33 shows the relevant section of the Properties<br />

page for that operator.<br />

Figure 2.33<br />

In order to understand what these values mean, we need some background. Whenever<br />

a physical operator, such as the Sort operator in an execution plan occurs, three things<br />

happen.<br />

• First, the physical operator is initialized and any required data structures are set up.<br />

This is called the Init() method. In all cases, this happens once for an operator,<br />

although it is possible for it to happen many times.<br />

• Second, the physical operator gets (or receives) the rows of data that it is to act on. This<br />

is called the GetNext() method. Depending on the type of operator, it may receive<br />

none, or many GetNext() calls.<br />

• Third, once the operator has performed its function, it needs to clean itself up and<br />

shut itself down. This is called the Close() method. A physical operator only ever<br />

receives a single Close() call.<br />

A rebind or rewind is a count of the number of times the Init() method is called by an<br />

operator. A rebind and a rewind both count the number of times the Init() method is<br />

called, but do so under different circumstances.<br />

106

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!