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 ...
随机推荐
- SQLServer2008设置开启INTERNET远程连接
SQL Server 2008默认是不允许远程连接的,sa帐户默认禁用的,如果想要在本地用SSMS连接远程服务器上的SQL Server 2008,需要做两个部分的配置: 使用sa账户登录SQL Se ...
- Linux chmod命令修改文件与文件夹权限命令代码
在Unix和Linux的各种操作系统下,每个文件(文件夹也被看作是文件)都按读.写.运行设定权限. 以下转自:http://www.codeceo.com/article/linux-chmod-co ...
- apacheserver下载、安装、配置
1.下载 下载地址:apache下载地址 点击左側"Download"下的链接,打开例如以下页面 这里能够选择版本号.我选择2.4.16.单击"2.4.16" ...
- delphi CoolBar这个怎么弄没了
CoolBar这个怎么弄没了 像Windows这样的 procedure TForm1.Button1Click(Sender: TObject); begin CoolBar1.Fix ...
- curl要注意的几点
1.post提交数据 $postData = array( 'paramCity' => array(array('id' => $city_id, 'day' => $city_d ...
- 解决fedora64下vim不能语法着色问题
初始状态是vim打开任何文件都没有高亮迹象,接不是彩色,也没有下划线,好了,看怎么一步步解决的... 1)#vim ~/.vimrc 竟然没有这个文件,创建之#touch vim ~/.vimrc 添 ...
- perl详解
http://www.blogjava.net/qileilove/archive/2013/09/04/403646.html
- jQuery事件之on()方法绑定多个选择器,多个事件
这样一个需求,如果用live()方法实现的话 非常简单,容易理解. $('nav li, #sb-nav li, #help li').live('click', function () { // c ...
- java_接口和抽象类的区别
1. 接口只能定义抽象方法,不包含已经提供实现的方法. 抽象类可以包含普通方法 2. 接口不能定义静态方法.抽象类可以定义静态方法 3. 接口里只能定义静态常量filed,不能定义普通filed. 抽 ...
- 谷歌chrome浏览器桌面提醒 webkitNotifications
原创: //点击时开启提醒 $(".message_alert").toggle(function(){ $(".message_alert_tip").htm ...