Home > Oracle Tips > Chapter Downloads > Oracle instance tuning techniques
Oracle Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

CHAPTER DOWNLOADS

Oracle instance tuning techniques


Donald Burleson
07.17.2006
Rating: -3.67- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Oracle professionals know that you must optimize your database by tuning global parameters before detailed application tuning can proceed. This excerpt from the bestselling book Oracle tuning: The definitive reference by Alexey Danchenkov and Donald Burleson reviews proven techniques for tuning any Oracle instance and has scripts to ensure that your database is optimized for its application load. Click here to read the full chapter.

One of the problems in Oracle9i was the single bit-flag that was used to monitor index usage. The flag can be set with the alter index xxx monitoring usage command, and see if the index was accessed by querying the v$object_usage view.

The goal of any index access is to use the most selective index for a query. This would be the one that produces the smallest number of rows. The Oracle data dictionary is usually quite good at this, but it is up to the DBA to define the index. Missing function-based indexes are a common source of suboptimal SQL execution because Oracle will not use an indexed column unless the WHERE clause matches the index column exactly.

The WISE tool is a great way to quickly plot Oracle time series data and gather signatures for Oracle metrics. WISE is also able to plot performance data on a daily or monthly average basis. See http://www.wise-oracle.com for details.

Tracking SQL nested loop joins

As a review, nested loop joins are the most common method for Oracle to match rows in multiple tables. Nested loop joins always invoke an index and they are never parallelized. The following awr_nested_join_alert. sql script to count nested loop joins per hour:

col c1 heading 'Date' format a20
col c2 heading 'Nested|Loops|Count' format 99,999,999
col c3 heading 'Rows|Processed' format 99,999,999
col c4 heading 'Disk|Reads' format 99,999,999
col c5 heading 'CPU|Time' format 99,999,999
accept nested_thr char prompt 'Enter Nested Join Threshold: '
ttitle 'Nested Join Threshold|&nested_thr'
select
to_char(sn.begin_interval_time,'yy-mm-dd hh24') c1,
count(*) c2,
sum(st.rows_processed_delta) c3,
sum(st.disk_reads_delta) c4,
sum(st.cpu_time_delta) c5
from
dba_hist_snapshot sn,
dba_hist_sql_plan p,
dba_hist_sqlstat st
where
st.sql_id = p.sql_id
and
sn.snap_id = st.snap_id
and
p.operation = 'NESTED LOOPS'
having
count(*) > &hash_thr
group by
begin_interval_time;

The output below shows the number of total nested loop joins during the snapshot period along with a count of the rows processed and the associated disk I/O. This report is useful where the DBA wants to know if increasing pga_aggregate_target will improve performance.

Nested Loop Join Thresholds

           Nested
           Loops              Rows        Disk     CPU
Date  Count      Processed    Reads    Time
-------------------- ----------- ----------- -----------
04-10-10 16 22 750 796 4,017,301
04-10-10 17 25 846 6 3,903,560
04-10-10 19 26 751 1,430 4,165,270
04-10-10 20 24 920 3 3,940,002
04-10-10 21 25 782 5 3,816,152
04-10-11 02 26 905 0 3,935,547
04-10-11 03 22 1,001 0 3,918,891
04-10-11 04 29 757 8 3,939,071

In the report above, nested loops are favored by SQL that returns a smaller number of rows_processed than hash joins, which tend to return largest result sets.

The following awr_sql_index.sql script exposes the cumulative usage of database indexes:

col c0 heading 'Begin|Interval|time' format a8
col c1 heading 'Index|Name' format a20
col c2 heading 'Disk|Reads' format 99,999,999
col c3 heading 'Rows|Processed' format 99,999,999
select
to_char(s.begin_interval_time,'mm-dd hh24') c0,
p.object_name c1,
sum(t.disk_reads_total) c2,
sum(t.rows_processed_total) c3
from
dba_hist_sql_plan p,
dba_hist_sqlstat t,
dba_hist_snapshot s
where
p.sql_id = t.sql_id
and
t.snap_id = s.snap_id
and
p.object_type like '%INDEX%'
group by
to_char(s.begin_interval_time,'mm-dd hh24'),
p.object_name
order by
c0,c1,c2 desc
;

The following is a sample of the output where the stress on every important index is shown over time. This information is important for placing index blocks into the KEEP pool to reduce disk reads and for determining the optimal setting for the important optimizer_index_caching parameter.

Begin
Interval    Index            Disk              Rows
time         Name       Reads    Processed
-------- -------------------- ----------- -----------
10-14 12 I_CACHE_STATS_1 114
10-14 12 I_COL_USAGE$ 201 8,984
10-14 12 I_FILE1 2 0
10-14 12 I_IND1 93 604
10-14 12 I_JOB_NEXT 1 247,816
10-14 11 I_KOPM1 4 2,935
10-14 11 I_MON_MODS$_OBJ 12 28,498
10-14 11 I_OBJ1 72,852 604
10-14 11 I_PARTOBJ$ 93 604
10-14 11 I_SCHEDULER_JOB2 4 0
10-14 11 SYS_C002433 302 4,629
10-14 11 SYS_IOT_TOP_8540 0 75,544
10-14 11 SYS_IOT_TOP_8542 1 4,629
10-14 11 WRH$_DATAFILE_PK 2 0
10-14 10 WRH$_SEG_STAT_OBJ_PK 93 604
10-14 10 WRH$_TEMPFILE_PK 0
10-14 10 WRI$_ADV_ACTIONS_PK 38 1,760

The above report shows the highest impact tables.

Click here to read the full chapter.

Rate this Tip
To rate tips, you must be a member of SearchOracle.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
Chapter Downloads
Oracle 11g: PL/SQL Basics
Oracle 11g: Backup and recovery concepts
Migrating to Oracle: Expert Secrets to Migrate from SQL Server and MySQL
Oracle Database 11g SQL Tuning
Upgrading to Oracle Database 11g
Tuning the Oracle database with initialization parameters
Protecting your online Oracle data
Rapid application development of Oracle Web systems
Oracle instance tuning techniques
Oracle RAC performance tuning

Oracle database performance problems and tuning
Oracle 11g data compression
Varchar or number for better performance?
Do statistics on SYS-owned objects hurt performance in 10g?
Inside the Oracle 11g SQL Performance Advisor, part 1
Inside the Oracle 11g SQL Performance Advisor, part 2
Difference between driving table and driver table in Oracle
Best design for E-Business Suite on hard drive
20GB data dictionary causing performance problems
Using the cost-based optimizer to improve Database 10g performance
Online tablespace reorganization in Oracle 9i

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.

HomeNewsTopicsTipsAsk the ExpertsMultimediaWhite PapersProductsBlogs
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2003 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts