Transform Hints in the Global Hints section are used to tell the optimizer how to process or transform the entire query.
Hint Name |
Description |
|---|---|
NO_QUERY_TRANSFORMATION |
Prevents any query rewriting. |
NO_COST_BASED_QUERY_TRANSFORMATION |
Prevents cost-based query rewriting. |
NO_QUERY_TRANSFORMATION Hint
The NO_QUERY_TRANSFORMATION Hint prevents any query rewriting for the current query, unlike the NO_REWRITE Hint in the Query Block Hint section. Using NO_QUERY_TRANSFORMATION prevents the use of Query Block Hints to enable certain rewritings.
For more information about query rewriting, see Overview of Query Rewriting.
Syntax
/*+ NO_QUERY_TRANSFORMATION */
Example
-- Use the `NO_QUERY_TRANSFORMATION` Hint to prevent any query rewriting.
SELECT /*+ NO_QUERY_TRANSFORMATION */ *
FROM (SELECT * FROM t1) v WHERE v.c1 = 3;
NO_COST_BASED_QUERY_TRANSFORMATION Hint
The NO_COST_BASED_QUERY_TRANSFORMATION Hint prevents any cost-based query rewriting for the current query. For more information about cost-based query rewriting, see Cost-Based Query Rewriting.
Syntax
/*+ NO_COST_BASED_QUERY_TRANSFORMATION */
Example
-- Use the `NO_COST_BASED_QUERY_TRANSFORMATION` Hint to prevent any cost-based query rewriting.
CREATE TABLE t1(c1 int, c2 int, c3 int, index idx1(c1), index idx2(c2));
SELECT /*+ NO_COST_BASED_QUERY_TRANSFORMATION */ *
FROM t1
WHERE c1 = 1 OR c2 = 1;
