码迷,mamicode.com
首页 > 其他好文 > 详细

cursor: pin S

时间:2015-02-28 21:42:53      阅读:147      评论:0      收藏:0      [点我收藏+]

标签:

cursor: pin S

OTN 解释如下:

  cursor: pin SA session waits on this event when it wants to update a shared mutex pin and another session is currently in the process of updating a shared mutex pin for the same cursor object. This wait event should rarely be seen because a shared mutex pin update is very fast.(Wait Time: Microseconds)
Parameter Description
P1 Hash value of cursor
P2 Mutex value (top 2 bytes contains SID holding mutex in exclusive mode, and bottom two bytes usually hold the value 0)
P3 Mutex where (an internal code locator) OR’d with Mutex Sleeps

今天收集性能报告Top 5 

 

Top 5 Timed Foreground Events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                           Avg
                                                          wait   % DB
Event                                 Waits     Time(s)   (ms)   time Wait Class
------------------------------ ------------ ----------- ------ ------ ----------
DB CPU                                          205,412          99.8
db file sequential read              68,063         487      7     .2 User I/O
log file sync                       139,316         233      2     .1 Commit
cursor: pin S                     1,163,270         127      0     .1 Concurrenc
SQL*Net message from dblink          97,575          46      0     .0 Network


Oracle10gR2中引用的mutexes机制一定程度的替代了library cache pin,其结构更简单,相当于,每个child cursor下面都有一个mutexes这样的简单内存结构,当有session中要执行该SQL而需要pin cursor操作的时候,session需要以shared模式set这个内存位+1,表示session获得该mutex的shared mode lock.可以有很多session同时具有这个mutex的shared mode lock;但是在同一时间,只能有一个session在操作这个mutext +1或者-1。+1 -1的操作是排它性的原子操作。如果因为session并行太多,则导致某个session在等待其他session的mutext +1/-1操作,则该session要等待cursor: pin S等待事件。


当看到系统有很多session等待cursor: pin S事件的时候,要么是CPU不够快,要么是某个SQL的并行执行次数太多了而导致在child cursor上的mutex操作争用。如果是前者,则可以升级硬件。如果是因为SQL的并行太多,则要么想办法降低该SQL执行次数,要么将该SQL复制成N个其它的SQL。

    select /*SQL 1*/ename from t where deptno=?
    select /*SQL 2*/ename from t where deptno=?
    select /*SQL …*/ename from t where deptno=?
    select /*SQL N*/ename from t where deptno=?




这样就有了N个SQL Cursor,N个Mutex内存结构,就将争用分散开来,类似partition的作用了。

cursor: pin S

标签:

原文地址:http://blog.csdn.net/wuweilong/article/details/43989745

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!