Home   IT Stuff   Contact link Contact: bill@dughaille.info Home  

Oracle Hints
The usual answer to the question, "When should I use hints?" is, "Never." However ...
HintDescription/formatExample
ALL_ROWSTells the optimiser to user the cost-based approach: minimum total resource consumptionselect /*+ ALL_ROWS */
APPENDTells to optimiser to insert new data above the high water mark, speeding up the insertinsert /*+ APPEND*/ into [tablename]
CACHE  
CHOOSEDeprecated from 11g onward 
CLUSTER  
CURSOR_SHARING_EXACT  
DRIVING_SITEDefine where a query is executed when run over a database linkselect /*+ DRIVING_SITE( [table_name] ) */ ...
DYNAMIC_SAMPLING  
FACT  
FIRST_ROWS( n )Get the first (n) rows as fast as possible: not relevant where a query requires all rows to process, e.g. ORDER BY, GROUP BYselect /*+ FIRST_ROWS(10) */
FULL  
HASH  
INDEX_ASCAs per INDEX hint, but search in ascending order 
INDEX_COMBINE  
INDEX_DESCAs per INDEX hint, but search in descending order 
INDEX_FFS  
INDEX_JOIN  
INDEX_SS_ASC  
INDEX_SS_DESC  
INDEX_SS  
INDEXUse a specific index: /*+ INDEX( [table_name] [index_name]) */SELECT /*+ INDEX (countries countries_name_ix)*/
country_code, country_name
FROM countries
WHERE country_name like 'AL%'
LEADING  
MERGE  
MODEL_MIN_ANALYSIS  
MONITOR  
NATIVE_FULL_OUTER_JOIN  
NO_EXPAND  
NO_FACT  
NO_INDEX_FFS  
NO_INDEX_SS  
NO_INDEX  
NO_MERGE  
NO_MONITOR  
NO_NATIVE_FULL_OUTER_JOIN  
NO_PARALLEL_INDEX  
NO_PARALLEL  
NO_PUSH_PRED  
NO_PUSH_SUBQ  
NO_PX_JOIN_FILTER  
NO_QUERY_TRANSFORMATION  
NO_RESULT_CACHE  
NO_REWRITE  
NO_STAR_TRANSFORMATION  
NO_UNNEST  
NO_USE_HASH  
NO_USE_MERGE  
NO_USE_NL  
NO_XML_QUERY_REWRITE  
NO_XMLINDEX_REWRITE  
NOAPPEND  
NOCACHE  
OPT_PARAM  
ORDEREDProcess tables in order of position in sqlselect /*+ ORDERED */ ...
PARALLEL_INDEX  
PARALLEL  
PQ_DISTRIBUTE  
PUSH_PRED  
PUSH_SUBQ  
PX_JOIN_FILTER  
QB_NAME  
RESULT_CACHE  
REWRITE  
RULEDeprecated from 11g onward; the hint FIRST_ROWS might achieve similar behaviour 
STAR_TRANSFORMATION   
UNNEST   
USE_CONCAT   
USE_HASH   
USE_MERGE   
USE_NL   
USE_NL_WITH_INDEX