2. Agenda
Oracle Tuning Overview
Two Types of Oracle Tuning
SQL Tuning Overview
SQL Tuning Steps
Writing Better SQL Statements
Using Indexes
3. Oracle Tuning Overview
Effective data collection and analysis is
essential for identifying and correcting
performance problems.
Low hardware will affect response time but
wise versa is not true always.
Increasing number of session pool will
increase performance too.
4. Two Types of Oracle Tuning
Instance Tuning
SQL Tuning
5. SQL Tuning Overview
The goals of SQL tuning involve verifying
the best execution plan for any statements.
Oracle support both automatic and manual
tuning.
Considering End User Response Time and
Server Resource Usage.
6. SQL Tuning Overview
If you INSERT into a table with three indexes, then it will be
approximately 10 times slower than an INSERT into a table
with no indexes.
The worst type of view use is when a view references other
views, and when they are joined in queries.
If you want SQL to accomplish different things, then write
various statements.
Rewriting an inefficient SQL statement is easier than
modifying it.
Using triggers consumes system resources. If you use too
many triggers, then you can find that performance is
adversely affected.
7. SQL Tuning Steps
Identifying high load or low performing SQL
statements (Ref Ex01).
Looking and Verifying oracle execution plan
(Ref Ex02).
Implementing corrective action.
Repeating above steps.
8. How Oracle Plan SQL
Execution
Gather data statistics (oracle support both
automatic and manual data gathering) (Ref
Ex03).
Query optimizer looking collected data and
plan better execution.
9. Writing Better SQL Statements
Get only required columns in the select statement.
Use untransformed column values in WHERE clauses
as much as possible.
Beware of implicit type conversions.
Combine Multiples Scans with CASE Statements.
Use DML with RETURNING Clause.
Modify All the Data Needed in Single SQL Statement.
10. Writing Better SQL Statements
Using Indexes
Do not build indexes unless necessary.
Consider indexing keys that are used frequently in WHERE
clauses.
Consider indexing keys that are used frequently to join tables
in SQL statements.
Columns that are frequently update are bad for indexing.
Columns that have long character strings are bad for
indexing.
Do not index keys that appear only in WHERE clauses with
functions or operators.
11. Writing Better SQL Statements
Index Types
Oracle includes numerous data structures to improve
the speed of Oracle SQL queries.
B-Tree Indexes are the most popular common index
type.
Create composite indexes with correct column ordering.
Use Bitmap Indexes for Performance.
Use function-based index either in transformed columns
or in an expression.