10.07.2015 Views

Expert Oracle Exadata - Parent Directory

Expert Oracle Exadata - Parent Directory

Expert Oracle Exadata - Parent Directory

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 2 OFFLOADING / SMART SCANSQL_ID CHILD OFFLOAD EXECS ELIGIBLE_BYTES SQL_TEXT------------- ------ ------- ----- -------------- --------------------05cq2hb1r37tr 0 Yes 3 58195968 select avg(pk_col) f1 row selected.Elapsed: 00:00:00.01In this example we used the _SERIAL_DIRECT_READ parameter to disable Smart Scans. This parameterdoes not invalidate cursors, so the same cursor was used for all three executions of the statement. If youlook at the second execution, you can probably guess that it didn’t use a Smart Scan, as it was slowerthan the previous execution. You can verify that assumption by noting that the Eligible Byte Count didnot increase. However, the fsx script simply checks to see if the value of theIO_CELL_OFFLOAD_ELIGIBLE_BYTES column is greater than 0. As you can see, the value of the columnremained the same between executions causing the fsx script to report that the statement wasoffloaded, even though the second execution was not offloaded. So keep in mind that our indicator is acumulative value for all the executions of this cursor. Note that in the previous example we set up arather unusual situation where a single cursor is offloaded on one execution and not on another. Thisrarely happens in real life.The technique demonstrated by the fsx script provides a very useful alternative to tracing or usingsession statistics to verify whether Smart Scans are being performed. The biggest advantage is that youdon’t have to try to catch Smart Scan in real time. The IO_CELL_OFFLOAD_ELIGIBLE_BYTES column is storedin V$SQL and related views, which means it’s also captured by AWR. This provides us with a historicalview into how statements have been processed in the past. It is one of the main tools that we use for aquick-and-dirty verification of whether a Smart Scan has been used or not.SQL MonitoringThere is one other tool that is very useful for determining whether a SQL statement was Offloaded. TheREPORT_SQL_MONITOR procedure is part of the new Real Time SQL Monitoring functionality that wasadded with 11g. It is built into the DBMS_SQLTUNE package and provides a great deal of information, notonly on whether a statement was offloaded, but also on which steps in a plan were offloaded. Here’s anexample (first of a statement that was not offloaded and then of the same statement when it wasoffloaded):SYS@SANDBOX1> alter session set cell_offload_processing=false;Session altered.SYS@SANDBOX1> set echo offSYS@SANDBOX1> @avgskew3AVG(PK_COL)-----------16093750.2SYS@SANDBOX1> @fsx4Enter value for sql_text: %skew3%Enter value for sql_id:58

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

Saved successfully!

Ooh no, something went wrong!