zoukankan      html  css  js  c++  java
  • SQL Server 编译缓存相关的知识点

    查看编译缓存统计信息

    1、运行dbcc命令

    dbcc proccache

    列名

    说明

    num proc buffs

    过程缓存中所有项使用的总页数。

    num proc buffs used

    当前正在使用的所有项使用的总页数。

    num proc buffs active

    仅为保持向后兼容。 当前正在使用的所有项使用的总页数。

    proc cache size

    过程缓存中的总项数。

    proc cache used

    当前正在使用的总项数。

    proc cache active

    仅为保持向后兼容。 当前正在使用的总项数。

    2、查看动态的DMV视图

    sys.dm_exec_cached_plans

    此视图中objtype的具体定义如下:

    说明

    Proc

    存储过程

    Prepared

    预定义语句

    Adhoc

    1' data-guid="9e1131e47bbc7b6179d45a72741b2fc5">即席查询 1

    ReplProc

    复制筛选过程

    Trigger

    Trigger

    View

    View

    默认

    默认

    UsrTab

    用户表

    SysTab

    系统表

    检查

    CHECK 约束

    规则

    规则

    select a.*,b.text
    from sys.dm_exec_cached_plans a
        cross apply sys.dm_exec_sql_text(a.plan_handle) b

    3、sys.dm_os_memory_cache_counters

    返回 SQL Server 中缓存运行状况的快照

    select name,type,sum(pages_kb),sum(pages_in_use_kb),sum(entries_count),sum(entries_in_use_count)
    From sys.dm_os_memory_cache_counters
    group  by name,type
    order by 3 desc

    ------------------------------------------------------------------------------------------------------------------------------------

    ------------------------------------------------------------------------------------------------------------------------------------

    清空编译缓存需要一个命令就可以,有时候在服务器遇到参数嗅探的时候,很管用

    dbcc freeproccache

    关于编译缓存的blog--摘自宋桑

    谈一谈SQL Server中的执行计划缓存(上)

    http://www.cnblogs.com/CareySon/archive/2013/05/04/PlanCacheInSQLServer.html

    谈一谈SQL Server中的执行计划缓存(下)

    http://www.cnblogs.com/CareySon/archive/2013/05/04/PlanCacheInSQLServerPart2.html
  • 相关阅读:
    Python Day14
    Python Day13
    Python Day12
    Python Day11
    Python Day10
    Python Day9
    Python Day8
    Python Day7
    Python Day6
    Python Day5
  • 原文地址:https://www.cnblogs.com/luck001221/p/4315463.html
Copyright © 2011-2022 走看看