zoukankan      html  css  js  c++  java
  • SQL Server查询执行过程

    1.查询过程

    1.1.query parse

    确认语法是否正确

    1.2.query binding

    确认对象(表,列等)是否正确

    1.3.query optimization

    生成执行计划,大多数会生成full cost-based plan(完全基于成本的),少部分生成trivial plan(琐碎的,不重要的,即只针对单个表的查询,且没有聚集,计算,分组等操作)

    基于成本的计划需要3个条件

    • Query processor tree
    • statistics

    统计信息影响到基数,选择性,其由以下部分组成
    1.the header – general data about a given set of statistics
    2.the density graph – the selectivity, uniqueness, of the data, and, most importantly
    3.a histogram – a tabulation of counts of the occurrence of a particular value, taken from
    up to 200 data points that are chosen to best represent the complete data in the table.
    内存压力或执行计划长期未被使用被新的计划挤出plan cache,手动执行下面的命令也会导致释放plan cache

    sys.dm_exec_query_stats  sql_handle和plan_handle
    dbcc freeproccache(<plan_handle>)
    DBCC FLUSHPROCINDB(db_id)
    
    • Constraints

    1.4.query execution phase

  • 相关阅读:
    Maven
    Mybatis
    WinDbg的安装、配置和功能(转发)
    gRPC —— gRPC 基础: C#(待续)
    gRPC —— 通讯协议
    gRPC —— 安全认证
    gRPC —— 概念
    gRPC —— 概览
    grpc和protocol buffer介绍&实例(转载)
    protocol buffers ——git 源码
  • 原文地址:https://www.cnblogs.com/ls11736/p/13628096.html
Copyright © 2011-2022 走看看