0% found this document useful (0 votes)
155 views

Oracle Tuning Tips

The document provides tips for optimizing Oracle database queries and performance. It recommends: 1) Only creating indexes on required columns; 2) Distributing data across multiple disks for tables with high I/O; and 3) Avoiding large data retrievals that return more than 10-20% of total data to prevent full table scans.

Uploaded by

vinod_ce
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
155 views

Oracle Tuning Tips

The document provides tips for optimizing Oracle database queries and performance. It recommends: 1) Only creating indexes on required columns; 2) Distributing data across multiple disks for tables with high I/O; and 3) Avoiding large data retrievals that return more than 10-20% of total data to prevent full table scans.

Uploaded by

vinod_ce
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

All About Software

Development
by TechHairBall
Blog Main / Archive / Invite Peers / Connect to this
blog

Previous Entry / Next Entry

Oracle Tuning Tips


TechHairBall posted 3/10/2006 | Comments (9)
These rules are simple but easy to follow and will yield lots of benefits:

Do not index every column in the table - have only those indexes, which are
required.

Distribute your data to parrallelise the IO operations among multiple disks


especially for those tables which have lots of IO's.

Try to avoid large data retrievals, since if the data being retrieved from a table
is more than 10%-20% of the total data, Oracle will most likely do the FST.

Never do a calculation on an indexed column (e.g., WHERE salary*5 >


:myvalue).

Whenever possible, use the UNION statement instead of OR conditions.

Avoid the use of NOT IN or HAVING in the WHERE clause. Instead, use the
NOT EXISTS clause.

Always specify numeric values in numeric form and character values in


character form (e.g., WHERE emp_number = 565, WHERE emp_name =
'Jones').

Avoid specifying NULL in an indexed column.

Avoid the LIKE parameter if = will suffice. Using any Oracle function will
invalidate the index, causing a full-table scan.

Never mix data types in Oracle queries, as it will invalidate the index. If the
column is numeric, remember not to use quotes (e.g., salary = 50000). For
char index columns, always use single quotes (e.g., name = 'NAME').
Remember that Oracle's rule-based optimizer looks at the order of table
names in the FROM clause to determine the driving table. Always make sure
that the last table specified in the FROM clause is the table that will return the
smallest number of rows. In other words, specify multiple tables with the
largest result set table specified first in the FROM clause.

Avoid using subqueries when a JOIN will do the job.

Use the Oracle "decode" function to minimize the number of times a table has
to be selected.

To turn off an index you do not want to use (only with a cost-based
optimizer), concatenate a null string to the index column name (e.g., name||')
or add zero to a numeric column name (e.g., salary+0). With the rule-based
optimizer, this allows you to manually choose the most selective index to
service your query.

If your query will return more than 20 percent of the rows in the table, use a
full-table scan rather than an index scan.

Always use table aliases when referencing columns.

You might also like