Tuesday, October 9, 2007

Oracle Hints

/*+ ALL_ROWS */

Explicitly chooses the cost-based approach to optimize a statement block with a goal of best throughput (that is, minimum total resource consumption)



/*+ CHOOSE */

Causes the optimizer to choose between the rule-based approach and the cost-based approach for a SQL statement based on the presence of statistics for the tables accessed by the statement



/*+ FIRST_ROWS */

Explicitly chooses the cost-based approach to optimize a statement block with a goal of best response time (minimum resource usage to return first row). It will also force the optimizer to make use of index, if available. There are other versions of FIRST_ROWS hints. This hint is useful in an OLTP environment when the user cannot wait till the last row is fetched. This is mainly used in Java lookup screens. If there are some calculations then this hint should not be used.



/*+ RULE */

Explicitly chooses rule-based optimization for a statement block



/*+ AND_EQUAL(table index) */

Explicitly chooses an execution plan that uses an access path that merges the scans on several single-column indexes



/*+ CLUSTER(table) */

Explicitly chooses a cluster scan to access the specified table



/*+ FULL(table) */

Explicitly chooses a full table scan for the specified table



/*+ HASH(table) */

Explicitly chooses a hash scan to access the specified table



/*+ HASH_AJ(table) */

Transforms a NOT IN sub query into a hash anti join to access the specified table



/*+ HASH_SJ (table) */

Transforms a NOT IN sub query into a hash anti-join to access the specified table



/*+ INDEX(table index) */

Explicitly chooses an index scan for the specified table



/*+ INDEX_ASC(table index) */

Explicitly chooses an ascending-range index scan for the specified table



/*+ INDEX_COMBINE(table index) */

If no indexes are given as arguments for the INDEX_COMBINE hint, the optimizer uses whatever Boolean combination of bitmap indexes has the best cost estimate. If particular indexes are given as arguments, the optimizer tries to use some Boolean combination of those particular bitmap indexes.



/*+ INDEX_DESC(table index) */

Explicitly chooses a descending-range index scan for the specified table



/*+ INDEX_FFS(table index) */

Causes a fast full index scan to be performed rather than a full table scan



/*+ MERGE_AJ (table) */

Transforms a NOT IN sub query into a merge anti-join to access the specified table



/*+ MERGE_SJ (table) */

Transforms a correlated EXISTS sub query into a merge semi-join to access the specified table



/*+ ROWID(table) */

Explicitly chooses a table scan by ROWID for the specified table



/*+ USE_CONCAT */

Forces combined OR conditions in the WHERE clause of a query to be transformed into a compound query using the

UNION ALL set operator



/*+ ORDERED */

Causes Oracle to join tables in the order in which they appear in the FROM clause



/*+ STAR */

Forces the large table to be joined using a nested-loop join on the index



/*+ DRIVING_SITE (table) */

Forces query execution to be done at a different site from that selected by Oracle



/*+ USE_HASH (table) */

Causes Oracle to join each specified table with another row source with a hash join



/*+ USE_MERGE (table) */

Causes Oracle to join each specified table with another row source with a sort-merge join



/*+ USE_NL (table) */

Causes Oracle to join each specified table to another row source with a nested-loops join using the specified table as the inner table



/*+ APPEND */ , /*+ NOAPPEND */

Specifies that data is simply appended (or not) to a table; existing free space is not used. Use these hints only following the INSERT keyword.



/*+ NOPARALLEL(table) */

Disables parallel scanning of a table, even if the table was created with a PARALLEL clause



/*+ PARALLEL(table, instances) */

This allows you to specify the desired number of concurrent slave processes that can be used for the operation. DELETE, INSERT, and UPDATE operations are considered for parallelization only if the session is in a PARALLEL DML enabled mode. (Use ALTER SESSION PARALLEL DML to enter this mode.)



/*+ PARALLEL_INDEX */

Allows you to parallelize fast full index scan for partitioned and non-partitioned indexes that have the PARALLEL attribute



/*+ NOPARALLEL_INDEX */

Overrides a PARALLEL attribute setting on an index



/*+ CACHE */

Specifies that the blocks retrieved for the table in the hint are placed at the most recently used end of the LRU list in the buffer cache when a full table scan is performed



/*+ NOCACHE */

Specifies that the blocks retrieved for this table are placed at the least recently used end of the LRU list in the buffer cache when a full table scan is performed



/*+ MERGE (table) */

Causes Oracle to evaluate complex views or sub queries before the surrounding query



/*+ NO_MERGE (table) */

Causes Oracle not to merge mergeable views



/*+ PUSH_JOIN_PRED (table) */

Causes the optimizer to evaluate, on a cost basis, whether or not to push individual join predicates into the view



/*+ NO_PUSH_JOIN_PRED (table) */

Prevents pushing of a join predicate into the view



/*+ PUSH_SUBQ */

Causes non merged sub queries to be evaluated at the earliest possible place in the execution plan



/*+ STAR_TRANSFORMATION */

Makes the optimizer use the best plan in which the transformation has been used.

8 comments:

Anonymous said...

Having reаd thiѕ I thought іt wаs verу infоrmаtive.
I аpρreciatе you tаking thе time
anԁ effoгt to put this content togethеr.

I oncе again find myself ѕρending
ωау tоo much timе both reading and сommеnting.

But ѕo what, іt waѕ still wοrth іt!


Feel free to suгf to my site click the next Webpage

Anonymous said...

I am tгulу grateful tο the holԁeг οf this sitе ωho
has ѕhareԁ this enormous ρіece of wгiting at
heгe.

Alѕo νisit my website; http://www.kmts.com

Anonymous said...

Greеtingѕ from Οhio! I'm bored to death at work so I decided to browse your website on my iphone during lunch break. I love the knowledge you present here and can't wait tο take a look when I gеt home.
I'm shocked at how fast your blog loaded on my phone .. I'm
not eνen using WIFI, just 3G .. Anyhοw, gгeat ѕіte!



Ηere iѕ my blog post: website allows users

Anonymous said...

Genuinely when ѕomeonе doesn't understand after that its up to other visitors that they will help, so here it happens.

my blog Bauchfett Loswerden

Anonymous said...

We stumblеԁ over here from а different wеbsitе and thought I may aѕ ωell
check things out. I lіke what I sее so now i am following yοu.
Look forward to explοring уοur wеb page уet аgaіn.



Checκ out my web pagе Bauchfett loswerden

Anonymous said...

Everything is vеry оpen ωith а clеaг claгifiсatiοn οf the challеnges.
Ӏt ωas dеfіnitely infοrmatіνe.
Youг ωebsite is νery usеful. Тhanks for ѕhагing!


Here is my blog pοst ... social network
my web page :: paid chat rooms

Anonymous said...

Неllo every one, here every one is ѕharing these experienсe, thеrefοrе іt's good to read this webpage, and I used to go to see this webpage all the time.

Also visit my web page Chat Room

Anonymous said...

Whаt's Happening i'm new to this, I stumblеd
upon thiѕ I've discovered It absolutely useful and it has helped me out loads. I hope to give a contribution & help different customers like its aided me. Great job.

Stop by my homepage; how to stop premature ejaculation