oracle hint (續-0)
USE_MERGE(table)
A merge join is an alternative to nested loop and hash joins. All tables are sorted, unless all of the columns in the WHERE clause are contained within an index. This sort can be expensive and it explains why a hash join will often run faster then a merge join.
SELECT /*+ USE_MERGE(w o) */ count(*)
FROM winners w, owners o
WHERE w.owner like 'Mr M A Gurry'
AND w.owner < o.owner
AND o.suburb = 'RICHMOND'
The entire set of data must be returned before a single row is returned to the user. Therefore hash joins are usually used for reporting and batch processing.
|
Merge joins work effectively for equality-based joins as well as for range-based joins. Merge joins also often run much faster than a hash join when all of the columns in the WHERE clause are pre-sorted in an index.
USE_NL(table)
Forces the optimizer to join the specified table to another table (or subquery) using a nested loop join. The specified table is joined as the inner table of the nested loops. Nested loop joins are faster than sort/merge or hash joins at retrieving the first row of a query statement
Online screens should definitely use nested loops, because data will be returned immediately. As a rule of thumb, if less than 10% of the rows are returned from the tables, consider using nested loops. Use hash joins or sort merges if 10% or more of the rows are being returned.
SELECT /*+ USE_NL(w o) */ count(*)
FROM winners w, owners o
WHERE w.owner like 'Mr M A Gurry'
AND w.owner= o.owner
AND o.suburb = 'RICHMOND'
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/90618/viewspace-464425/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle hint (續)Oracle
- oracle hintOracle
- ORACLE 部分HINTOracle
- Oracle Hint 精華Oracle
- 【TUNE_ORACLE】Oracle Hint之常用Hint功能概述(五)Oracle
- 【TUNE_ORACLE】Oracle Hint之常用Hint功能概述(四)Oracle
- 【TUNE_ORACLE】Oracle Hint之常用Hint功能概述(三)Oracle
- 【TUNE_ORACLE】Oracle Hint之常用Hint功能概述(二)Oracle
- 【TUNE_ORACLE】Oracle Hint之常用Hint功能概述(一)Oracle
- oracle之hint概述Oracle
- oracle常見hintOracle
- oracle hint簡述Oracle
- oracle hint_no_indexOracleIndex
- Oracle Hint 精華文章Oracle
- 常用的Oracle HintOracle
- Oracle Hint 詳解Oracle
- Oracle Hint的用法Oracle
- oracle hint之hint_index_ffs,index_joinOracleIndex
- ORACLE的HINT詳解Oracle
- Oracle中Hint隨記Oracle
- oracle hint no_mergeOracle
- oracle hint_no_expand_no_factOracle
- oracle hint_cache_nocacheOracle
- Oracle 常用HINT介紹Oracle
- (轉)Oracle Hint的用法Oracle
- oracle hint有效範圍Oracle
- ORACLE使用HINT的方法Oracle
- Oracle索引HINT的使用Oracle索引
- Oracle中的sql hintOracleSQL
- zt_Oracle hint driving_site Hint的用法Oracle
- Oracle中常見的Hint(一)Oracle
- Oracle之Hint使用總結Oracle
- oracle hint_leadingOracle
- oracle hint_noappend_parallelOracleAPPParallel
- oracle hint_no_parallel_no_parallel_indexOracleParallelIndex
- oracle hint_parallel_parallel_indexOracleParallelIndex
- 常見Oracle HINT的用法Oracle
- ORACLE進階之一:HINTOracle