Question: When do
I use the no_cpu_costing hint on a SQL statement. I am
on 12c and I understand that the no_cpu_costing hint can
improve SQL performance. Can you explain how the
no_cpu_costing hint works?
Answer: The no_cpu_costing hint
was introduced to turn off
the including of CPU costs in the
decision tree for choosing the "best" execution plan.
This hint turns off CPU costing for the SQL
statement. CBO then uses the IO cost model, which measures
everything in single-block reads and ignores CPU cost.
Make sure to read these important notes on
the optimizer cost model.
Oracle introduced CPU costing as the default
_optimizer_cost_model=cpu because most Oracle database are
CPU-bound and you want to optimizer SQL to minimize CPU
costs. However, there are cases where you want to use
I/O costs when optimizing a SQL statement (this can be done
system-wide by setting _optimizer_cost_model=io).
I/O-bound databases, (especially older 32-bit databases),
may want to utilize I/O-based SQL costing. The default
optimizer costing in Oracle10g and beyond is CPU, and it can
be changed to IO costing by using these techniques:
SQL> alter system set
SQL> alter session set
hidden parameter for a permanent change:
SQL> alter system set
There are many documented cases in Oracle 12c and beyond
where you want to improve the speed of SQL statements by
turning-off CPU costing at the statement level:
select /*+ no_cpu_costing */ col1
Oracle Training from Don Burleson
The best on site
training classes" are just a phone call away! You can get personalized Oracle training by Donald Burleson, right at your shop!
Burleson is the American Team
documentation was created as a support and Oracle training reference for use by our
DBA performance tuning consulting professionals.
Feel free to ask questions on our
considering using the services of an Oracle support expert should
independently investigate their credentials and experience, and not rely on
advertisements and self-proclaimed expertise. All legitimate Oracle experts
Oracle technology is changing and we
strive to update our BC Oracle support information. If you find an error
or have a suggestion for improving our content, we would appreciate your
and include the URL for the page.
Copyright © 1996 - 2020
All rights reserved by
is the registered trademark of Oracle Corporation.