Logical query-processing phases in brief

(1) FROM

This phase identifies the query’s source tables and processes table operators.
Each table operator applies a series of subphases.
For example, the phases involved in a join are
(1-J1) Cartesian Product, (1-J2) ON Predicate, (1-J3) Add Outer Rows.
This phase generates virtual table VT1.

(1-J1) Cartesian Product 

This phase performs a Cartesian product (cross join) 
between the two tables involved in the table operator, generating VT1-J1.

(1-J1) Cartesian Product This

This phase filters the rows from VT1-J1 based on the predicate
that appears in the ON clause (<on_predicate>).
Only rows for which the predicate evaluates to TRUE are inserted into VT1-J2.

(1-J3) Add Outer Rows

If OUTER JOIN is specified (as opposed to CROSS JOIN or INNER JOIN), 
rows from the preserved table or tables for which a match was not found 
are added to the rows from VT1-J2 as outer rows, generating VT1-J3.

(2) WHERE

This phase filters the rows from VT1 based on the predicate that appears in the WHERE clause (<where_predicate>). 
Only rows for which the predicate evaluates to TRUE are inserted into VT2.

(3) GROUP BY

This phase arranges the rows from VT2 in groups based on the set of expressions 
(aka, grouping set) specified in the GROUP BY clause, generating VT3. Ultimately, 
there will be one result row per qualifying group.

(4) HAVING

This phase filters the groups from VT3 based on the predicate that 
appears in the HAVING clause (<having_predicate>). Only groups for 
which the predicate evaluates to TRUE are inserted into VT4.

(5) SELECT

This phase processes the elements in the SELECT clause, generating VT5.

(5-1) Evaluate Expressions

This phase evaluates the expressions in the SELECT list, generating VT5-1.

(5-2) DISTINCT

This phase removes duplicate rows from VT5-1, generating VT5-2.

(6) ORDER BY

This phase orders the rows from VT5-2 according to the list specified in the ORDER BY clause, 
generating the cursor VC6. Absent an ORDER BY clause, VT5-2 becomes VT6.

(7) TOP | OFFSET-FETCH

This phase filters rows from VC6 or VT6 based on the top or offset-fetch specification, 
generating VC7 or VT7, respectively. With TOP, this phase filters the specified 
number of rows based on the ordering in the ORDER BY clause, or based on arbitrary order 
if an ORDER BY clause is absent. With OFFSET-FETCH, this phase skips the specified number of rows, 
and then filters the next specified number of rows, based on the ordering in the ORDER BY clause. 
The OFFSET-FETCH filter was introduced in SQL Server 2012.

to be end

最新文章

  1. handlebars模板替换
  2. 软件测试作业1--描述Error
  3. Android之Intent深入
  4. IOS第五天(2:用户登录,回车的监听(代理模式UITextFieldDelegate)) 和关闭键盘
  5. iOS 学习笔记 七 (2015.03.29)code snippet操作
  6. 转载---SQL Server XML基础学习&lt;1&gt;之--FOR XML PATH
  7. WinRAR5.31 注册码
  8. # 团队作业8——第二次项目冲刺(Beta阶段)--5.27 seventh day
  9. ajax之XML简介
  10. Asp.Net Web API(六)
  11. python将数据写入excel代码,python与office交互
  12. MIP 技术交流分享(3月15日)
  13. docker搭建gitlab服务器(Centos7)
  14. HDU4857 逃生 拓扑排序
  15. java.lang.UnsatisfiedLinkError: dlopen failed: library &quot;libsqlite.so&quot; not found
  16. win10 x64中 windbg x64 安装配置符号库
  17. SQL Server 查询性能优化——覆盖索引
  18. python接口自动化-token参数关联登录(二)
  19. 在WebGL场景中管理多个卡牌对象的实验
  20. javascript实现对html便签等字符的转义

热门文章

  1. Jquery制作--循环滚动列表
  2. web 安全杂谈
  3. 理解Attribute
  4. HTML5的File API读取文件信息
  5. codeforces682A
  6. 百度地图多点路径加载以及调整页面js
  7. js 对数据转换成数据容量单位
  8. 面向对象Part4
  9. ABAP READ TABLE语句注意
  10. 常见端口 HTTP代码