Oratips: Oracle 'S Approach To Performance Tuning, Part 1
Oratips: Oracle 'S Approach To Performance Tuning, Part 1
Page
By Darrick Addison
Editor’s Note: You would not drive formance goals, as well as goals • Redo log setup problems
a car in need of service nor play an for the future.
out of tune piano? In his first ORAtips • Serialization of data blocks in the
article, a two part series, Darrick • Get a full set of operating system, buffer cache due to lack of free
Addison brings home the point that database, and application sta- lists, free list groups, transaction
your biggest Oracle investment, the tistics from the system when the slots (INITRANS), or shortage of
Oracle database, needs regular care performance is both good and rollback segments.
and feeding to run at maximum bad.
efficiency and peak performance. • Long full table scans
Darrick discusses the pros and cons • Sanity-check the operating sys-
of Oracle’s new approach for 10g tems of all machines involved • In disk sorting
tuning, identifying no less than 17 with user performance. By san-
problematic queries, and answers ity-checking the operating sys- • High amounts of recursive (SYS)
the questions “what do I look for and tem, you look for hardware or SQL
how do I make it better?” operating system resources that
are fully utilized. • Schema errors and Optimizer
Introduction problems
Performance tuning is a broad and
complex topic area when it comes to • Use of non-standard initializa-
Oracle databases. Two of the big- tion parameters
gest questions faced by your aver-
age DBA concern where to start and 3. Build a conceptual model of what
what to do. All you may know is that Two of the biggest is happening on the system, using
someone reports a problem about a the symptoms as clues to under-
slow or poor performing applica- questions faced by stand what caused the perfor-
tion or query. Where do you even mance problems.
begin to start when faced with this your average DBA
situation? Oracle’s emphasis on this 4. Propose a series of remedy actions
particular methodology changed concern where to and the anticipated response of
when Oracle10g was released. The the system, and then apply them
approach has gone from top-down in start and what to do. in the order that can benefit the
8i and 9i to that of following prin- application the most. A golden
ORAtipsJournal
The Change Is Part of the 4. Avoid use of indexes on col- ate (partitioning is an extra
Problem umns contained in the WHERE cost feature).
The change from a top-down struc- clause.
tured approach to a principle-based 16. Use literals in the WHERE
“make it stop hurting” one is part 5. Avoid joining too many tables. clause (use bind variables).
of the problem. Gathering statistics
is obviously important, because how 6. Monitor V$SESSION_LON- 17. Keep statistics up to date.
would you know if you have improved GOPS to detect long running
(or worsened) the problem? To some operations. The list overall is thorough and
degree with either approach, you are accurate.
left with the original two questions: 7. Use hints as appropriate.
what do I look for, and how do I Note: Step 9, referring to the use of
make it better? 8. Use the SHARED_CURSOR the Rule-based optimizer, may cause
parameter. a reliance or dependency on a feature
What would help the novice tuner Oracle has identified as a future item
is a list of items or areas to analyze 9. Use the Rule-based optimizer if to be deprecated.
(configure, diagnose, and tune) in it is better than the Cost-based
each of the following: optimizer. Using Bind Variables
On any number of DBA help-type
• Tuning the Buffer Cache 10. Avoid unnecessary sorting. Web sites, a frequently seen bit of
• Tuning the Redo Log Buffer advice is to use bind variables, but
• Tuning the Shared Pool Memory 11. Monitor index browning (due rarely are the steps or instructions
• Tuning the Program Global Area to deletions; rebuild as neces- for this step included. Figure 1 illus-
• Optimizing Data Storage sary). trates a simple method for creating
• Optimizing Table spaces and using a bind variable.
• Tuning Undo Segments 12. Use compound indexes with
• Detecting Lock Contention care (do not repeat columns). Figures 2 and 3 compare querying
• Tuning SQL for employee ID and name with and
13. Monitor query statistics. without the bind variable (with the
These areas pretty much cover the output turned off using trace only).
Oracle RDBMS and instance from 14. Use different table spaces for
top to bottom. tables and indexes (as a gen- Okay, so the difference is not that
eral rule; this is old-school great (the cost went from 3 to 2), but
Listed below are guidelines to somewhat, but the main point this was a small example. The main
assist you in avoiding common mis- is reduce I/O contention). point of the previous section is using
takes and bad coding. and understanding bind variables.
15. Use table partitioning (and None of these steps is especially dif-
ORAtipsJournal
17 Tips for Avoiding local indexes) when appropri- ficult to perform or implement. For
Problematic Queries
These tips provide a solid founda- SQL> variable department_id number
tion for two outcomes: making a SQL SQL> begin
statement perform better, and deter- 2 :department_id := 80;
mining that nothing else can be done 3 end;
in this regard. 4/
DataFactory
The purpose of DataFactory is to
“quickly create meaningful test data
for multiple database platforms.”
• Create a project
The purpose of
DataFactory is to
ORAtipsJournal
“quickly create
meaningful test
Figure 6: List of Tutorial Objects Created
data for multiple
database
platforms.”
The information on our website and in our publications is the copyrighted work of Klee Associates, Inc. and is owned by Klee Associates, Inc. NO WARRANTY: This
documentation is delivered as is, and Klee Associates, Inc. makes no warranty as to its accuracy or use. Any use of this documentation is at the risk of the user. Although
we make every good faith effort to ensure accuracy, this document may include technical or other inaccuracies or typographical errors. Klee Associates, Inc. reserves
the right to make changes without prior notice. NO AFFILIATION: Klee Associates, Inc. and this publication are not affiliated with or endorsed by Oracle Corporation.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Klee Associates, Inc. is a member of the Oracle Partner Network
This article was originally published by Klee Associates, Inc., publishers of JDEtips and SAPtips.
For training, consulting, and articles on JD Edwards or SAP, please visit our websites:
www.JDEtips.com and www.SAPtips.com.
ORAtipsJournal