Just as the
revolutionized Oracle9i tuning, the new Oracle10g AWR tables have
revolutionized SQL tuning. Most Oracle experts note that SQL
optimization is one of the most important factors in database
tuning, yet the transient nature of SQL execution has made it
difficult to see the impact of SQL execution over time. All of this
changed with Oracle10g.
The AWR tables contain useful information about
the time-series execution plans for SQL statements, and this
repository can be used to display details about the frequency of
usage for table and indexes.
The following basic relationships between
database objects and SQL statements are important:
Each SQL statement may generate many access plans:
From the information on dynamic sampling and
dbms_stats, the execution
plans for SQL statements will change over time to accommodate
changes in the data they access. It is important to understand how
and when a frequently executed SQL statement changes its access
Each object is access by many access plans: In most
OLTP systems, tables and indexes show repeating patterns of usage
and clear patterns can be detected when averaging object access of
day-of-the-week and hour-of-the-day.
Time-series relationships between SQL and database objects
Figure 15.18 shows that there is a many-to-many
relationship between any given SQL statement and the tables they
access. Once this fundamental relationship is clear, the AWR tables
can be used to perform time-based SQL tuning. We have the following
AWR tables for SQL tuning as shown in 15.19:
The dba_hist views for SQL
These simple tables represent a revolution in
Oracle SQL tuning, and time-series techniques can be employed to
optimize SQL with better results than ever before. The following
section provides a closer look at these AWR tables and the amazing
details that they can provide about SQL execution over time.
Ion tool is
also excellent for identifying SQL to tune and it can show SQL
execution over time with stunning SQL graphics.