关于v$librarycache的几个字段含义

对v$librarycache中的get,pin和reload的含义:
Gets: (Parse) The number of lookups for objects of the namespace
Pins: (Execution) The number of reads or executions of the objects of the namespace
Reloads: (Reparse) The number of library cache misses on the execution step,causing implicit reparsing of the statement and block

lijing回复:
当一个sql语句传给oracle之后,oracle首先要到share pool中找有没有相同的语句存在,如果没有就进行硬解析;
如果有的话就算作是算作是一次get,并查找这条sql语句的执行计划,如果在执行计划已经不存在了或者是存在但不可用,那么就必须对这条sql语句重新进行一个硬解析,这就叫reload,
如果执行计划存在并且可用的话,oracle就执行这句话,这就叫做execution

rwq_ 质疑:
“如果在执行计划已经不存在了或者是存在但不可用,那么就必须对这条sql语句重新进行一个硬解析”这一句值得怀疑:执行计划是在硬解析中生成的吗?


lijing回复:
看看hard parse要做些什么:
the parse step must complete the following tasks:
 1.Check the statement for syntactic correctness.
 2.Perform object resolution where the names and structures of the referenced objects are checked against the data dictionary.
 3.Gather statistics regarding the objects referenced in the query by examining the data dictionary.
 4.Prepare and select an execution plan from among the available plans,including the determination of whether Stored Outlines or Materialized Views are relevant.
 5.Determine the security for the objects referenced in the query by examining the data dictionary.
 6.Generate a compiled version of the statement (calledP-Code).

--摘自Sybex 的《Oracle9i Performance Tuning Study Guide》 

 

posted @ 2018-10-16 17:12  PoleStar  阅读(620)  评论(0编辑  收藏  举报