zoukankan      html  css  js  c++  java
  • SQL执行计划

    Table Scan 扫描
    Index Scan 索引扫描
    Index Seek 索引查找
    Clustered Index Scan 聚集索引扫描
    Clustered Index Seek 聚集索引查找

    • MS-SQL Server什么时候使用"Table Scan"?
    • MS-SQL Server什么时候使用"Index Scan"?
    • MS-SQL Server什么时候使用"Index Seek"? 
    • MS-SQL Server什么时候使用"Clustered Index Scan"?
    • MS-SQL Server什么时候使用"Clustered Index Seek"?

    首先建立索引聚集索引

    create unique clustered index index_PRCode on 表名(字段名)

    当在WHERE后用到(字段名)字段的时候,“Clustered Index Seek”被用到用到“Index Seek”是因为WHERE后面使用带索引的“字段”来进行过滤

    Index Seek(索引查找)”在性能改善上比“Index Scan(索引扫描)”和“Table Scan(表扫描)”要好,这主要表现在下面几个方面:

    1. “Index Seek”不需要对表和索引页进行扫描;而“Table Scan”和“Index Scan”需要。
    2. “Index Seek”利用“WHERE”来过滤获取的数据,这样比用“Index Scan”和“Table Scan”快很多。

    从改善性能角度考虑,“Clustered Index Seek”比“Clustered Index Scan”和“Index Seek”要好。

    1. “Clustered Index Seek”不需要扫描整个聚集索引页。
    2. 和“Index Scan”相比,对于检索选择的字段包含那些没有索引的字段时,“Clustered Index Seek”不会有“Bookmark Lookup”方法出现。
  • 相关阅读:
    设计模式
    包装类
    php 闭包的理解
    is_null empty isset等的判定
    PHP基础一 $this ,static 和 self的区别
    lumen安装踩过得坑
    composer的使用和安装
    使用submine来写c++
    php 和 thinkphp中的常量一览
    路径问题 ./ / ../ 空 的区别
  • 原文地址:https://www.cnblogs.com/edword/p/3142324.html
Copyright © 2011-2022 走看看