Transform Hint specifies how the optimizer should handle 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 Query Block Hint, using NO_QUERY_TRANSFORMATION means that some rewritings enabled by Query Block Hint cannot be applied.
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;