zoukankan      html  css  js  c++  java
  • Can we remove a single query plan

    Can we remove a single query plan?

    You can use sp_recompile system stored procedure to clear it if the type of query plan is proc,trigger or function

    Else you can't. If the received parameter of sp_recompile is a object(such as table), sql server will regenerate a new query plan when the table was refer next time, but the current plan will not be removed.

    You can use DBCC FREEPROCCACHE the remove all the query plan cached in memory

    or

    use DBCC FLUSHPROCINDB to remove cached plan of specific database

     

    How to get the size of cached plan?

    For the single cached plan, size_in_bytes from sys.dm_exec_cached_plans dmv can help you.

    For the whole procedure cache, run the DBCC MEMORYSTATUS command

    In The Procedure Cache section

     

    How to get the number of cached plans

    use the DBCC MEMORYSTATUS command

    In The Procedure Cache section

    Or run following script

    select *from sys.dm_os_memory_cache_entries where type in

    ('CACHESTORE_OBJCP','CACHESTORE_SQLCP',

    'CACHESTORE_PHDR','CACHESTORE_XPROC')

  • 相关阅读:
    oracle备份表和数据
    sql 替换字段中的部分字符,替换指定字符
    前端MVVM框架
    学习Bootstrap
    oracle 取前10条记录
    sql时间比较
    vlookup函数的使用
    树的遍历
    Java数据结构和算法(四)——栈
    面试大全之JVM篇
  • 原文地址:https://www.cnblogs.com/stswordman/p/1543030.html
Copyright © 2011-2022 走看看