Rebind and Rewind in Execution Plans
http://www.scarydba.com/2011/06/15/rebind-and-rewind-in-execution-plans/
Ever looked at an execution plan? If you answered no, you can’t possibly have ever tried to tune a query, or, you’re doing it wrong. For every one else, no doubt you’ve looked at the tool tips or the property sheets of an operator and you’ve seen the Rebind & Rewind properties and wondered what the heck they mean. Me too.
I learned as much as I could for the book on execution plans and I spent two pages describing it. Then, a little while ago, on the SQL Cruise, someone asked me to describe them and I was flummoxed. Specifically they said the explanation in the book was insufficiently clear, so I promised to put together a blog post on the topic, both to attempt to clarify my explanation and to reacquaint myself with the topic.
These properties reflect the number of times an operator was initialized, or started. It’s that easy for the initial definition. But it gets complicated quickly. Rebind & Rewind are only applicable when dealing with a loop join. They don’t apply to other situations, which is why they’re mostly zero when you see them. They are only applicable to the inner side of the loop.
Not only are Rebind and Rewind only involved with loop joins, but they only apply to certain operators: Nonclustered Index Spool, Remote Query, Row Count Spool, Sort, Table Spool, and Table-valued Function.
The difference between a rebind and rewind has to do with the values that are part of the loop join itself. As those values change, as different data is accessed in the outer part of the loop, you see rebinds. When those values aren’t changed then you’ll see a rewind. You’ll also see that the aggregation of these values is equal to the number of rows in the outer join.
Here’s an example query:
[sourcecode language=”sql”]SELECT  sod.SalesOrderDetailID FROM    Sales.SalesOrderDetail AS sod WHERE   LineTotal < (SELECT AVG(dos.LineTotal) FROM   Sales.SalesOrderDetail AS dos WHERE  dos.ModifiedDate < sod.ModifiedDate )[/sourcecode] It puts out an execution plan that’s pretty ugly, but at least it shoes a table spool in a loop join as you can see: ![]()
If you look at the properties then we can see the values showing multiple rebinds and rewinds that total up to the number of rows in the outer part of the loop.
![]()
Rebind and Rewind in Execution Plans的更多相关文章
- 简译《Dissecting SQL Server Execution Plans》——连载总入口
		
转载请注明出处 由于工作及学习需要,最近看了一下<Dissecting SQL Server Execution Plans>,这是少有的专门描述执行计划的优秀书籍,为了快速查找并供入门同 ...
 - 《Pro SQL Server Internals, 2nd edition》的CHAPTER 3 Statistics中的Introduction to SQL Server Statistics、Statistics and Execution Plans、Statistics Maintenance(译)
		
<Pro SQL Server Internals> 作者: Dmitri Korotkevitch 出版社: Apress出版年: 2016-12-29页数: 804定价: USD 59 ...
 - Oracle SQL explain/execution  Plan
		
From http://blog.csdn.net/wujiandao/article/details/6621073 1. Four ways to get execution plan(anyti ...
 - Execution Plan 执行计划介绍
		
后面的练习中需要下载 Demo 数据库, 有很多不同的版本, 可以根据个人需要下载. 下载地址 -http://msftdbprodsamples.codeplex.com/ 1. 什么是执行计划 ...
 - sql是如何执行一个查询的!
		
引用自:http://rusanu.com/2013/08/01/understanding-how-sql-server-executes-a-query/ Understanding how SQ ...
 - Understanding how SQL Server executes a query
		
https://www.codeproject.com/Articles/630346/Understanding-how-SQL-Server-executes-a-query https://ww ...
 - Microsoft SQL Server  Version List    [sqlserver 7.0-------sql server 2016]
		
http://sqlserverbuilds.blogspot.jp/ What version of SQL Server do I have? This unofficial build ch ...
 - Microsoft SQL Server Version List(SQL Server 版本)
		
原帖地址 What version of SQL Server do I have? This unofficial build chart lists all of the known Servic ...
 - SqlServer 版本号
		
RTM (no SP) SP1 SP2 SP3 SP4 SQL Server 2014 codename Hekaton 12.00.2000.8 SQL Server 2012 ...
 
随机推荐
- EasyUI 下拉列表联动
			
//绑定部门.人员下拉菜单项 function BindDdl() { var $ddlbm = $("#ddlBm");//部门下拉列表 var $ddlry = $(" ...
 - Jquery EasyUi实战教程布局篇
			
转自:http://www.kwstu.com/ArticleView/kwstu_20139413501290 送给大家一个非常好的后台布局模板,本人后来就选择了这个模板http://www.kws ...
 - 时间的函数,sleep,clock,gettickcount,QueryPerformanceCounter(转)
			
介绍 我 们在衡量一个函数运行时间,或者判断一个算法的时间效率,或者在程序中我们需要一个定时器,定时执行一个特定的操作,比如在多媒体中,比如在游戏中等,都 会用到时间函数.还比如我们通过记录函数或者算 ...
 - 序列化对象C++对象的JSON序列化与反序列化探索
			
新手发帖,很多方面都是刚入门,有错误的地方请大家见谅,欢迎批评指正 一:背景 作为一名C++开发人员,我始终很期待能够像C#与JAVA那样,可以省力的进行对象的序列化与反序列化,但到现在为止,还没有找 ...
 - python写的百度贴吧相册下载
			
突然想搞个这样的工具,写来写去都不知道在干嘛了,本来两个文件,现在整合在一起了. 乱得不行,懒得整理了,能用就行. 下载部分用了多线程,但是下载一个文件还是用的单线程,也就是没管http头的range ...
 - hdu 5279 Reflect phi  欧拉函数
			
Reflect Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://bestcoder.hdu.edu.cn/contests/contest_chi ...
 - android 自定义按钮实现 home键 和返回键
			
由于在自己做的东西中用到了就总结一下,自己做了测试 在一个程序运行中如果按 返回键 分别执行了 : onpause() onStop() onDestory()方法 如果点击 home键 ...
 - 使用快盘托管Git库
			
Dropbox非常好用.可是我如今也没弄明确究竟哪里好用了.不如试试中国的金山快盘..起码不会操心被墙. cd ~/Kuaipan/repo git --bare init //初始化仓库 cd ~/ ...
 - LINUX 内核2
			
http://blog.csdn.net/acs713/article/category/1363650
 - hadoop实例---多表关联
			
多表关联和单表关联类似,它也是通过对原始数据进行一定的处理,从其中挖掘出关心的信息.如下 输入的是两个文件,一个代表工厂表,包含工厂名列和地址编号列:另一个代表地址表,包含地址名列和地址编号列.要求从 ...