Sie sind auf Seite 1von 2

Rewrite complex subqueries with temporary tables - Oracle created the

global temporary table

(GTT) and the SQL WITH operator to help divide-and-conquer complex SQL
sub-queries

(especially those with with WHERE clause subqueries, SELECT clause scalar
subqueries and

FROM clause in-line views). Tuning SQL with temporary tables (and
materializations in the

WITH clause) can result in amazing performance improvements.

Use minus instead of EXISTS subqueries - Some say that using the minus
operator instead of

NOT IN and NOT Exists will result in a faster execution plan.

Use SQL analytic functions - The Oracle analytic functions can do


multiple aggregations

(e.g. rollup by cube) with a single pass through the tables, making them
very fast for

reporting SQL.

Index your NULL values - If you have SQL that frequently tests for NULL,
consider creating

an index on NULL values. To get around the optimization of SQL queries


that choose NULL

column values (i.e. where emp_name IS NULL), we can create a function-


based index using the

null value built-in SQL function to index only on the NULL columns.

Avoid the use of NOT IN or HAVING. Instead, a NOT EXISTS subquery may run
faster (when

appropriate).

Avoid the LIKE predicate = Always replace a "like" with an equality, when
appropriate.

Never mix data types - If a WHERE clause column predicate is numeric, do


not to use quotes.
For char index columns, always use quotes. There are mixed data type
predicates:

Use decode and case - Performing complex aggregations with the decode
or "case" functions

can minimize the number of times a table has to be selected.

Das könnte Ihnen auch gefallen