DaveWentzel.com            All Things Data

Rewinds and Rebinds


The exact definition of a rewind and rebind is kinda complicated.  A rebind occurs when at least one of the correlated parameters of a join change and the inner side must be reevaluated.  A rewind occurs when none of the parameters change and the inner result set can be reused. 


First, the rebind and rewind counts should be as low as possible (duh).  Higher counts likely mean more data is being read, so higher I/O.  Higher counts mean that operator is doing a lot of potentially needless work.  Obviously, try rewriting the query or modify your indexes. 


You will see these values with spools, sorts and table-valued Function calls.  For many of the other physical operators the value is always 0 regardless. 


Another example is a recursive CTE which might use a spool operator to do the actual looping to determine the output.  As the second row of the "parent" result set is processed in the UNION ALL a choice of a rewind or rebind is made.  If the same parent is retrieved you'll likely see a rewind, if a different parent is retrieved you'll likely see a rebind, which means data is likely be retrieved and is likely a more expensive operation.   



Thanks a lot sir for the easy explanation on this complicated concept.