select /*+ index(customer cust_primary_key_idx) */ * from customer;
/*+ ALL_ROWS */
Explicitly chooses the cost-based approach to optimize a statement block with a goal of best throughput .
/*+ 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.
Test your PL/SQL knowledge, Which code runs faster?
/*+ 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
/*+ 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
/*+ ALL_ROWS */
Explicitly chooses the cost-based approach to optimize a statement block with a goal of best throughput .
/*+ 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.
Test your PL/SQL knowledge, Which code runs faster?
/*+ 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
/*+ 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
No comments:
Post a Comment