Transform hints under the global hint type are used to instruct the optimizer how to handle or transform an entire query.
| Hint | Description |
|---|---|
NO_QUERY_TRANSFORMATION |
Prevents any query rewriting for the current query. |
NO_COST_BASED_QUERY_TRANSFORMATION |
Prevents cost-based query rewriting for the current query. |
NO_QUERY_TRANSFORMATION hint
The NO_QUERY_TRANSFORMATION hint prevents any query rewriting for the current query. This hint is different from the NO_REWRITE hint specified for a query block. You cannot use the NO_QUERY_TRANSFORMATION hint to enable some rewriting operations that are enabled for the query block by using the NO_REWRITE hint.
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 cost-based query rewriting for the current query. For more information about cost-based query rewriting, see Introduction to cost-based 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;