11.07.2015 Views

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

174 CHAPTER 4 ■ PERFORMANCE MANAGEMENTIf the selectivity of the predicate doesn’t fall inside the existing cube, then the databasecan’t find a matching child cursor. As a result, the database performs a hard parse, generatinga new child cursor with a different execution plan. If two hard parses generate an identicalexecution plan, the child cursors are merged.Briefly, bind-aware cursor sharing means that the database will share an execution planwhen the bind values are roughly equivalent. The optimizer will delineate a selectivity rangefor an execution plan, and it’ll use the same plan if the new bind values fall within this selectivityrange. If the binds are not equivalent according to the selectivity range, the optimizer willgenerate a new execution plan with a different selectivity range.Monitoring Adaptive Cursor SharingThe V$SQL view has several new database views as well as new columns that help you monitoradaptive cursor sharing in the database. Since adaptive cursor sharing is automatic, you don’thave to actually do anything. Here’s a brief description of the new views:• V$SQL_CS_HISTOGRAM: Shows the distribution of the execution count across theexecution history histogram• V$SQL_CS_SELECTIVITY: Shows the selectivity cubes or ranges stored in cursors forpredicates with bind variables• V$SQL_CS_STATISTICS: Contains the execution information gathered by the databaseto decide on whether it should use bind-aware cursor sharing and includes buffer getsand CPU time, among the statisticsIn addition to these new views, the V$SQL view has two important new columns to supportadaptive cursor sharing. The IS_BIND_SENSITIVE column shows whether a cursor is bind-sensitive.The IS_BIND_AWARE column shows whether a cursor in the cursor cache has been markedto use bind-aware cursor sharing. Here’s a simple query showing the two new columns:SQL> select sql_id, executions, is_bind_sensitive, is_bind_awarefrom v$sql;SQL_ID EXECUTIONS I I---------------------- ------------------- --- ---57pfs5p8xc07w 21 Y N1gfaj4z5hn1kf 4 Y N1gfaj4z5hn1kf 4 N N...294 rows selected.SQL>If the IS_BIND_SENSITIVE column shows Y, it means the optimizer is planning to use multipleexecution plans, depending on the value of the bind variable. If the IS_BIND_AWARE columnshows Y, it means the optimizer knows that the bind variable values result in different datapatterns. In this case, the optimizer may hard-parse the statement.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!