Beruflich Dokumente
Kultur Dokumente
Engineered Systems
ABSTRACT
We all have to do "more with less" and focus on "immediate ROI" - as a DBA, it can be difficult to allocate time and/or
money on anything other than "firefighting"/"keeping the lights on".
Managing Exadata appropriately can realize exponential performance improvements to key IT infrastructure facilitate better
business decisions and actually reduce costs.
The customer has bought a sports car - but sometimes doesn't realize that they haven't taken it out of second gear. Yet.
COLLABORATE Abstract
DBA 3.0 How to Become a Real-World Exadata DBA (Presentation)
White Paper
This paper focuses on the most important feature of Exadata the SmartScan. The paper explains how SmartScans work,
how to make your queries eligible for SmartScans and how to manage indexes and parallelism on an Exadata database.
TARGET AUDIENCE
Database administrators / Exadata administrators / Exadata data machine administrators / developers on Exadata databases.
EXECUTIVE SUMMARY
After attending the presentation, the attendee should have gained an insight into how modern DBAs support Exadata and
be able to take a deep-dive into the most important Exadata performance feature - SmartScans.
After attending the presentation and reading the white paper, the learner will be able to:
Make appropriate configuration decisions during the initial Exadata installation.
Maximize and monitor Exadatas performance features such as SmartScan and EHCC.
Troubleshoot / performance-tune the use of Exadata SmartScans in their database.
1|Pag e
D B A 3 .0 H o w t o B e c o m e a R e a l - W o r l d E x ad at a D B A
White Paper
However, with the right configuration and support, a well-tuned Exadata system should realize a 8-10x performance
improvement, with some systems benefiting from up to a 15x improvement.
This paper describes how SmartScans work, how to make your queries eligible for SmartScans and how to manage parallelism
on an Exadata database.
2|P ag e
D B A 3 .0 H o w t o B e c o m e a R e a l - W o r l d E x ad at a D B A
White Paper
Storage indexes are populated during the fetch of data of a SmartScan, so the first queries after a cell restart often process a lot
more data; obviously, they cant exclude certain regions as the indexes are in the process of being rebuilt.
On V2 machines, offloaded processing on newly-started storage cells was noticeably worse until the indexes had been rebuilt.
For X3-2 machines and up, this appears to be less noticeable, though the storage indexes are still transient.
3|P ag e
D B A 3 .0 H o w t o B e c o m e a R e a l - W o r l d E x ad at a D B A
White Paper
Without the use of hidden storage cell parameters, it is not possible to influence the contents of storage indexes as they are
automatically managed by the storage cell.
Storage indexes will not work in the following conditions:
They are not created on CLOBs.
They do not work with predicates using the != operator or the % wildcard.
The _smu_debug_mode parameter is set to 134217728.
The _enable_minscn_cr parameter is set to FALSE.
SmartScan Eligibility
For the optimizer to consider a SmartScan, the query must be eligible:
The query must perform full object scans (full-table or full-index scans).
The query must bypass the database buffers and use direct path reads via the PGA.
Even with a full-table scan, direct path reads will not occur if the query is running serially. Using parallelism will
usually force direct path reads and make the query eligible for SmartScans, though this is not always the case.
Eligible SQL functions can be seen in the V$SQLFN_METADATA view (SmartScan eligibility does not guarantee that
SmartScans will happen).
physical read total bytes is all the data including compressed data AND SmartScan-ineligible data.
cell physical IO interconnect bytes includes the writes (multiplied due to ASM mirroring) AND the reads.
cell IO uncompressed bytes is the data volume for predicate offloading AFTER the Storage Index filtering and
any decompression
cell physical IO interconnect bytes returned by smart scan includes uncompressed data.
physical read total bytes all non-system data which was read from the storage cells
4|P ag e
D B A 3 .0 H o w t o B e c o m e a R e a l - W o r l d E x ad at a D B A
White Paper
cell physical IO bytes eligible for predicate offload data that is eligible for SmartScan processing (total direct path
reads)
cell physical IO bytes saved by storage index data that the cells did not need to scan through because the storage
indexes told them they were not in that region.
cell IO uncompressed bytes data read from the storage cells for predicate offloading, after the storage index
filtering and data decompression. N.B. compressed data has to be uncompressed first before applying the predicates
on the storage cells.
cell physical IO interconnect bytes returned by smart scan data returned to the database from the SmartScan.
Subtracting the cell physical IO interconnect bytes returned by smart scan from the cell physical IO bytes eligible
for predicate offload shows the amount of I/O AVOIDED by using SmartScans.
For instance:
cell physical IO bytes eligible for predicate offload = 1,511,049,773,060
MINUS
cell physical IO interconnect bytes returned by smart scan = 110,441,960,872
EQUALS
I/O in bytes avoided by using SmartScans = 1,400,607,812,188
In this case:
5|P ag e
D B A 3 .0 H o w t o B e c o m e a R e a l - W o r l d E x ad at a D B A
White Paper
6|P ag e
D B A 3 .0 H o w t o B e c o m e a R e a l - W o r l d E x ad at a D B A
White Paper
A SmartScan Example
As an example, lets say we wanted to run the following query:
SELECT customer_name
FROM customer
WHERE nonuniquecol > 200;
Lets also say that the CUSTOMER table is 1Tb in size and our query will bring back a total of 2Mb of data.
With SmartScans, we offload processing to the storage cells so they do the "heavy-lifting" of figuring out which data to bring
back. The storage cell only returns the 2Mb of data to the database instance as it has already filtered out data which is not
required.
To prove that were using SmartScans, we should see a STORAGE clause in the operation name in the explain plan:
EXPLAIN PLAN FOR
SELECT customer_name
FROM customer
WHERE nonuniquecol > 200;
SELECT *
FROM TABLE(DBMS_XPLAN.DISPLAY);
Execution Plan
---------------------------------------------------------Plan hash value: 87389835
---------------------------------------------------------------------------------| Id | Operation
| Name
| Rows
| Bytes
| Cost (%CPU)| Time |
---------------------------------------------------------------------------------| 0 | SELECT STATEMENT
| customer | 2000000 | 2097152 | 635342 (1)| 00:00:09 |
7|P ag e
D B A 3 .0 H o w t o B e c o m e a R e a l - W o r l d E x ad at a D B A
White Paper
|* 1 | TABLE ACCESS STORAGE FULL | customer | 2000000 | 2097152 | 635342 (1)| 00:00:09 |
--------------------------------------------------------------------------------Predicate Information (identified by operation id):
--------------------------------------------------1 - storage("NONUNIQUECOL"=200)
filter("NONUNIQUECOL "=200)
Lets also check the statistics (after weve run the query):
SELECT customer_name
FROM customer
WHERE nonuniquecol > 200;
2000000 rows returned.
COL value FORMAT 999999999999999999999999999999
SELECT vsys.name,
vmys.value
FROM v$sysstat vsys,
v$mystat vmys
WHERE vsys.statistic# = vmys.statistic#
AND vsys.name IN (
'cell physical IO bytes eligible for predicate offload',
'cell physical IO interconnect bytes returned by smart scan'
)
ORDER BY vsys.name;
NAME
---------------------------------------------------------------cell physical IO bytes eligible for predicate offload
cell physical IO interconnect bytes returned by smart scan
VALUE
------------------------------1801489640
20971520
This tells us that without a SmartScan, we would have pulled back 1801489640 bytes from the storage, but with SmartScan, we
reduced that to just 20971520 bytes giving us a SmartScan ratio of 98.86%.
Next, lets check what the V$SQL view shows. We know our explain plan is 87389835 and lets assume that the SQL_ID is
5t34tq47tz3p5:
SELECT sql_id,
hash_value,
ROUND ((io_cell_offload_eligible_bytes/1024/1024),2) AS elig_mb,
ROUND ((io_cell_offload_returned_bytes/1024/1024),2) AS return_mb,
8|P ag e
D B A 3 .0 H o w t o B e c o m e a R e a l - W o r l d E x ad at a D B A
White Paper
9|P ag e
HASH_VALUE
-----87389835
ELIG_MB
-----1718.03
RETURN_MB SKIP_MB
----------20
1716.03
RATIO
-----98.86
D B A 3 .0 H o w t o B e c o m e a R e a l - W o r l d E x ad at a D B A
White Paper
*/
CREATE OR REPLACE FORCE VIEW DSI001.INDEX_MONITOR ("Owner", "Table Name", "Index Name",
"Monitored?", "Used?", "Monitoring Started", "Monitoring Ended", "Unique?", "Index Size (Mb)") AS
SELECT "Owner",
"Table Name",
"Index Name",
"Monitored?",
"Used?",
"Monitoring Started",
"Monitoring Ended",
"Unique?",
"Index Size (Mb)"
FROM
(
10 | P a g e
D B A 3 .0 H o w t o B e c o m e a R e a l - W o r l d E x ad at a D B A
White Paper
11 | P a g e
D B A 3 .0 H o w t o B e c o m e a R e a l - W o r l d E x ad at a D B A
White Paper
CURRENT_MB
---------10368
MAX_MB
---------11520
CURRENT_SMALL
---------207.36
MAX_SMALL
---------------230.4
D B A 3 .0 H o w t o B e c o m e a R e a l - W o r l d E x ad at a D B A
White Paper
For more information about this parameter, raise a Service Request with Oracle Support.
13 | P a g e
TABLE_NAME
---------TAB1
TAB2
TAB3
DEGREE
---------DEFAULT
20
1
D B A 3 .0 H o w t o B e c o m e a R e a l - W o r l d E x ad at a D B A
White Paper
To check parallelism set at the index level (dont forget to check index partitions in DBA_IND_PARTITIONS):
SELECT owner, index_name, index_type, uniqueness, degree
WHERE owner IN (APP_OWNER,MYSCHEMA)
AND uniqueness = NONUNIQUE
ORDER BY degree, owner, index_name;
OWNER
---------APP_OWNER
APP_OWNER
MYSCHEMA
INDEX_NAME
---------IDX1
IDX2
IDX1
INDEX_TYPE
---------NORMAL
BITMAP
NORMAL
UNIQUENESS DEGREE
------------------NONUNIQUE DEFAULT
NONUNIQUE 20
NONUNIQUE 1
Inheriting Parallelism
DONT FORGET that an object will inherit an operations degree of parallelism. If you perform an ALTER INDEX
REBUILD . PARALLEL 20; statement, this will set the object-level parallelism of the index to 20.
SELECT owner, index_name, index_type, uniqueness, degree
WHERE index_name = MYVLTABLE_IDX_BIG
AND owner = MYSCHEMA;
OWNER
INDEX_NAME
------------------MYSCHEMA MYVLTABLE_IDX_BIG
14 | P a g e
D B A 3 .0 H o w t o B e c o m e a R e a l - W o r l d E x ad at a D B A
White Paper
For example, if you do not want the ADHOC_GROUP consumer group users to consume excessive parallelism with their
queries, set their maximum degree of parallelism per query to 4 and limit the number of active sessions per instance
to 4. This will restrict these users to a maximum of 16 parallel slaves per user per instance.
Obviously, you should inform the users prior to this change, but expect to receive calls nonetheless after the change with users
complaining that their connections are spinning or hourglassing likely because they have already hit their limit of active
sessions per instance and they are attempting to open a new connection.
If Resource Manager is limiting user connections, you will see a resmgr wait event on the session that is attempting to
connect.
In the authors experience, no user has ever complained about their maximum degree of parallelism per query being limited,
whether it by the Resource Manager or by changing the object level parallelism. Indeed, it is very likely that they will see a
performance improvement if we are able to use SmartScans.
Implementing Resource Manager is a useful if incidental - way to identify the real power users of the system, to discover
any examples of user accounts being shared amongst users and to identify any clients which are not closing
connections properly (i.e. older versions of the TOAD application)
15 | P a g e
D B A 3 .0 H o w t o B e c o m e a R e a l - W o r l d E x ad at a D B A
White Paper
References
My Oracle Support: Exadata Smart Scan FAQ (Doc ID 1927934.1)
My Oracle Support: Smart scan : Find the statistics related to cell offload (Doc ID 1438173.1)
My Oracle Support: Oracle Sun Database Machine Application Best Practices for Data Warehousing [Doc ID 1094934.1]
Uwe Hesse: http://uhesse.com/2011/07/06/important-statistics-wait-events-on-exadata/
16 | P a g e
D B A 3 .0 H o w t o B e c o m e a R e a l - W o r l d E x ad at a D B A
White Paper
17 | P a g e
D B A 3 .0 H o w t o B e c o m e a R e a l - W o r l d E x ad at a D B A
White Paper