zoukankan      html  css  js  c++  java
  • 产生library cache latch原因

    产生library cache latch原因
    The library cache latches protect the cached SQL statements and objects' definitions held
    in the library cache within the shared pool. The library cache latch must be acquired
    in order to add a new statement to the library cache. During a parse, Oracle searches
    the library cache for a matching statement. If one is not found, then Oracle will parse
    the SQL statement, obtain the library cache latch and insert the new SQL.

    可能导致library cache latch contention
    When you have unnecessary versions of a cursor, each time that cursor is executed,
    the parse engine has to search through the list of versions to see which is the cursor that you want.
    This wastes CPU cycles that you could be using on something else.

    High version counts can easily cause high contention for library cache latches.
    A process parsing a SQL statement with many versions (children cursors) will need to scan
    through all these children while holding on to a library cache latch.
    This means that other processes needing the same latch will have to wait and


    每一个sql被执行之前,先要到library cache中根据hash_value查找parent cursor,这就需要先获得library cache latch;找到parent cursor后,就会去查找对应的child cursor,当发现无法找到时,就会释放library cache latch,获得share pool latch分配空间给硬解析后的产生的执行计划;
    然后再次获得library cache latch进行把执行计划放入share pool,转入library cache pin+lock(null模式)开始执行sql.library cache latch 的个数有限(与CPU_COUNT参数相关),当数据库中出现大量硬解析的时候,某一个sql无法得到library cache latch就会开始spin,达到spin count后还没得到,
    就会开始sleep,达到sleep时间后,醒来还再次试图过的library cache latch得不到就在spin再得不到又sleep…依此类推.
    综上可知:在sql执行的过程中可以看出在出现High Versions Count和Hard Parse的情况下都有可能出现library cache latch等待.
    关于Hard Parse见:shared pool latch 等待事件
    关于High Versions Count见:关于High Versions Count总结

    转载 http://www.xifenfei.com/3151.html

  • 相关阅读:
    Sqlite && EF Code FIRST 终极解决方案 2019.5.17
    网卡 API 相关
    (依赖注入框架:Ninject ) 一 手写依赖注入
    Nlog 日志框架简单教程
    调试时候输出信息到输出窗口
    利用VS 性能探查器 解决代码性能不高问题
    Image 释放
    记一次数据丢失(电脑硬盘closed to down)的经历
    [极短]数字求和
    在博客园中使用pixijs
  • 原文地址:https://www.cnblogs.com/future2012lg/p/4303560.html
Copyright © 2011-2022 走看看