 |
|
Oracle Database Tips by Donald Burleson |
Processed iostat data
The processed results can be reviewed and
compared to previous days. This will help determine whether the
current performance issue is related to I/O performance. If so,
this might mean I/O is causing the problem and the proper course of
action is to determine if any storage configurations have been
changed. More likely, there was a change to the application or how
the users are using it and suddenly there are full table-scans where
there used to be index reads. This could be overtaxing some
component of the storage system.
Tuning SQL
When looking at a whole-system tuning
approach, SQL analysis and tuning may be necessary. Whether SQL
tuning in analyzing a performance issue is a factor will depend on
the applications the organization is using and the experience and
skill of the developers. Even with talented developers, their goal
is to provide a working application. Therefore, tuning can take a
back seat until the production users get to assess the scalability
of the application and the DBA gets involved because "the database
is slow."
"I wonder if I/O would be improved if we
plugged these back in."
SQL tuning becomes a requirement when, after
determining that the biggest bottleneck in the system is I/O and
that the response time is lacking and impacting the users, it
becomes apparent that enhancing the storage hardware is not the only
solution. If the only change in system statistics is that the
number of I/O operations has increased dramatically, and there is no
corresponding business driver; i.e., acquisition, merger or sales
spike, to account for this, there may be a new piece of code or old
statistics that are causing unnecessary I/O operations.
The Oracle Optimizer is used to determine
the best way to access the data. It works in two modes, Rule and
Cost. Rule-based Optimization (RBO) has a set of rules it follows
to determine the best execution plan. The Cost Based Optimizer (CBO)
determines the best way to access the data based on the relative
cost of different execution plans.
Before version 8i, the CBO was not always as
smart as an average DBA, so hints were often needed. Hints provided
the DBA a way to influence the optimizer toward more efficient
execution plans. Gradually, the CBO has gotten more efficient to
the point where now a hint rarely results in a better execution
plan.
If it is determined that there is some
'bad' SQL that needs to be tuned, there are several possible target
areas:
-
Reduce or eliminate unnecessary I/O,
which is commonly done by eliminating a full table-scan.
Sometimes the most efficient execution plan is to use a full
table-scan, so elimination of full table-scans may not be
recommended.
-
Appropriate index creation and usage is
important. If there is an index that can never be used
effectively, then it should be dropped. If there are several
indexes, it might make sense to combine them into a single
concatenated index.
-
Use the buffer cache when I/O is
appropriate and required. If there are several small tables
that are frequently accessed, and they do not all fit in the
buffer cache, increase it if they are the source of a
performance problem.
-
Reduce excessive parsing. This is not
necessarily a SQL tuning issue, but if a PL/SQL loop is designed
poorly, parsing could result every time through a loop when it
is not needed.
There are other factors involved in tuning
SQL. Since there are already good books on the subject, this book
will not go into a great deal of detail in this area. This book
will focus on identifying 'bad' SQL with the Wait Interface when
that is the cause of a performance problem in the database.
The above book excerpt is from:
Oracle Wait Event Tuning
High Performance with Wait
Event Iinterface Analysis
ISBN 0-9745993-7-9
Stephen Andert
http://www.rampant-books.com/book_2004_2_wait_tuning.htm |