Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
7Activity
0 of .
Results for:
No results containing your search query
P. 1
The AWR Tables Contain Super-useful Information About

The AWR Tables Contain Super-useful Information About

Ratings: (0)|Views: 1,459|Likes:
Published by qzbq5f

More info:

Published by: qzbq5f on Feb 14, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

09/23/2010

pdf

text

original

 
The AWR tables contain super-useful information about the time-seriesexecution plans for SQL statements and this repository can be used todisplay details about the frequency of usage for table and indexes.This article will expore these AWR tables and expose their secrets.The AWR tables contain super-useful information about the time-seriesexecution plans for SQL statements and this repository can be used todisplay details about the frequency of usage for table and indexes.This article will expore these AWR tables and expose their secrets.We have the following AWR tables for SQL tuning (Figure 1).odba_hist_sqlstatodba_hist_sql_summaryodba_hist_sql_workareaodba_hist_sql_planodba_hist_sql_workarea_histogramThese simple tables represent a revolution in Oracle SQL tuning and wecan now employ time-series techniques to optimizer SQL with betterresults than ever before. Let's take a closer look at these views.
dba_hist_sqlstat
This view is very similar to the
v$sql
view but it contains importantSQL metrics for each snapshot. These include important delta (change)information on disk reads and buffer gets, as well as time-series deltainformation on application, I/O and concurrency wait times.col c1 heading 'Begin|Interval|time' format a20col c2 heading 'SQL|ID' format a13col c3 heading 'Executions|Delta' format 9,999col c4 heading 'Buffer|Gets|Delta' format 9,999
1
 
col c5 heading 'Disk|Reads|Delta' format 9,999col c6 heading 'IO Wait|Delta' format 9,999col c7 heading 'Application|Wait|Delta' format 9,999col c8 heading 'Concurrency|Wait|Delta' format 9,999break on c1 skip 2break on c2 skip 2select begin_interval_time c1, sql_id c2, executions_delta c3,buffer_gets_delta c4, disk_reads_delta c5, iowait_delta c6,apwait_delta c7, ccwait_delta c8 from dba_hist_sqlstat natural joindba_hist_snapshot order by c1, c2;
dba_hist_sql_plan
The
dba_hist_sql_plan
table contains time-series data about each object(table, index, view) involved in the query. The important columnsinclude the
cardinality 
,
cpu_cost
,
io_cost
and
temp_space
required forthe object.The query below will show the main predicates involved for each objectcomponent in a SQL execution plan:col c1 heading 'Begin|Interval|time' format a20col c2 heading 'SQL|ID' format a13col c3 heading 'Object|Name' format a20col c4 heading 'Search Columns' format 99col c5 heading 'Cardinality' format 99col c6 heading 'Access|Predicates' format a80col c6 heading 'Filter|Predicates' format a80break on c1 skip 2break on c2 skip 2select begin_interval_time c1, sql_id c2, object_name c3,search_columns c4, cardinality c5, access_predicates c6,filter_predicates c7 from dba_hist_sql_plan natural joindba_hist_snapshot order by c1, c2;
2
 
But there is lots more information in
dba_hist_sql_plan
that is useful.The query below will extract importing costing information for allobjects involved in each query.col c1 heading 'Begin|Interval|time' format a20col c2 heading 'SQL|ID' format a13col c3 heading 'Object|Name' format a20col c4 heading 'Search Columns' format 9,999col c5 heading 'Cardinality' format 9,999col c6 heading 'Disk|Reads|Delta' format 9,999col c7 heading 'Rows|Processed' format 9,999break on c1 skip 2break on c2 skip 2select begin_interval_time c1, sql_id c2, object_name c3, bytes c4,cpu_cost c5, io_cost c6, temp_space c7 from dba_hist_sql_planorder by c1, c2;Now that we see the important table structures lets examine how we canget spectacular reports from this AWR data.
 Viewing table and index access with AWR 
One of the problems in Oracle9i was the single bit-flag that was usedto monitor index usage. You could set the flag with the "
alter index xxx monitoring usage
" command, and see if the index was accessed byquerying the
v$object_usage
view.The goal of any index access is to use the most selective index for aquery, the one that produces the smallest number of rows. The Oracledata dictionary is usually quite good at this, but it is up to you todefine the index. Missing function-based indexes are a common source ofsub-optimal SQL execution because Oracle will not use an indexed columnunless the WHERE clause matches the index column exactly.col c1 heading 'Begin|Interval|time' format a20col c2 heading 'SQL|ID' format a13col c3 heading 'Object|Name' format a20col c4 heading 'Search Columns' format 999,999col c5 heading 'Cardinality' format 999,999col c6 heading 'Disk|Reads|Delta' format 999,999col c7 heading 'Rows|Processed' format 999,999
3

Activity (7)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
Ulrich Santander liked this
Arun Prasad liked this
ian_carney liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->