Oracle CPU Costing
原文連線:
http://itspace.javaeye.com/blog/644780
[@more@]Oracle CPU Costing |
Turning on CPU Costing
The default setting for the optimizer cost model is CHOOSE, meaning that the presence of CBO statistics will influence whether or not CPU costs are considered. According to the documentation, CPU costs are considered when SQL optimizer schema statistics are gathered with the dbms_stat.gather_system_stats package, which is the default behavior in Oracle10g, and CPU costs will be considered in all SQL optimization.
It gets tricky because of Bug 2820066 where CPU cost is computed whenever optimizer_index_cost_adj is set to a non-default value. Unless the 9.2.0.6 server patch set has been applied, the Oracle9i database may be generating CPU statistics, regardless of the CBO stats collection method.
To ensure that CPU costing is in use:
§ In Oracle9i, use dbms_stats.gather_system_stats to collect statistics
§ Set the undocumented parameter _optimizer_cost_model=cpu;
Turning on I/O Costing
I/O-bound databases, especially 32-bit databases, may want to utilize I/O-based SQL costing. The default optimizer costing in Oracle10g is CPU, and it can be changed to IO costing by using these techniques:
§ Ensure that optimizer_index_cost_adj is set to the default value (Oracle9i bug 2820066)
§ Add a no_cpu_costing hint in the SQL
§ alter session set “_optimizer_cost_model=io;
§ Set init.ora hidden parameter _optimizer_cost_model =io
Notes on Bug 2820066:
CPU cost is computed when optimizer_index_cost_adj is set to a non-default value. If optimizer_index_cost_adj is set to a non-default value, CPU costs are calculated regardless of the optimizer cost model used. If optimizer_index_cost_adj is set and the optimizer CPU cost model is not in use, but the explain plan shows that for queries not using domain indexes CPU costs are being calculated, this bug is likely in play.
In sum, CPU cost is always computed regardless of optimizer mode when optimizer_index_cost_adj is set in unpatched Oracle versions less than 10.1.0.2.
The following section shows how to change from CPU-based to I/O-based SQL optimization when the processing characteristics of the database change on a regular basis.
--=================================
Hi all
I have an explain plan like below. and I doubt about the COST.
How is the COST be calculated? I mean what does that mean? (CPU
rate?)
SQL> @?/rdbms/admin/utlxpls.sql
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 1764098166
------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)|
Time |
------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 7824 (1)|
00:01:34 |
| 1 | SORT AGGREGATE | | 1 |
| |
| 2 | INDEX FAST FULL SCAN| BIG_TABLE_PK | 6812K| 7824 (1)|
00:01:34 |
------------------------------------------------------------------------------
The cost reported by the optimizer has always been a time estimate. It
just uses an odd unit which is single block reads. In your particular
case you see the overall cost is 7824 single block reads. The TIME
column tells you this cost turned into time by simply multiplying the
cost with the single block read time which is available if you have
System Statistics enabled (default from 10g on). We can deduce from
both the 94 seconds and the cost of 7824 that your average single
block read time according to your system statistics seems to be 12 ms
(94,000 ms / 7824 is quite close to 12 ms).
You can check your SYS.AUX_STATS$ table for the SREADTIM value - if it
is blank then you are running with (default) NOWORKLOAD System
Statistics and the single block read time is derived from IOSEEKTIM,
IOTFRSPEED and your default DB_BLOCK_SIZE.
The 12 ms are the default single block read time with default
NOWORKLOAD System Statistics and a default 8 KB default block size.
The % CPU is the estimated percentage of CPU cost of the calculated
cost, since with System Statistics the optimizer also includes an
estimation of the CPU cost required to execute the statement.
For more information, see e.g.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
Co-author of the "OakTable Expert Oracle Practices" book:
30226684
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/19602/viewspace-1037218/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- SAP Product Lifecycle Costing 裡的 Costing Sheet 成本核算表
- SAP ERP 裡的 Costing Sheet 成本核算表
- Tuning CPU 100% in Oracle 11g rac-20220215Oracle
- Oracle資料庫 11.2.0.4 EMON程式持續消耗CPUOracle資料庫
- Oracle CPU使用率過高問題處理Oracle
- SAP PM 入門系列之19 - IP31 Maintenance Plan CostingAINaN
- oracle資料庫CPU特別高的解決方法Oracle資料庫
- Oracle 補丁那些事兒(PS、PSU、CPU、SPU、BP、DBBP…)Oracle
- Oracle效能優化-資料庫CPU使用率100%Oracle優化資料庫
- Oracle優化案例-教你線上搞定top cpu的sql(十二)Oracle優化SQL
- Oracle 檢查當前資料庫CPU和PSU補丁資訊Oracle資料庫
- 【TUNE_ORACLE】檢視系統CPU和IO情況SQL參考OracleSQL
- Oracle 12c系列(四)|資源隔離之IO、記憶體、CPUOracle記憶體
- 【雲趣科技】Oracle優化案例-教你線上搞定top cpu的sql(十三)Oracle優化SQL
- 總結導致oracle資料庫主機CPU sys%高的一些原因Oracle資料庫
- 散片CPU為什麼比盒裝CPU便宜很多?CPU散片靠譜嗎?
- CPU-Z
- CPU簡介
- native到CPU
- CPU快取快取
- CPU效能分析
- 伺服器CPU比家用CPU更有哪些優勢伺服器
- Linux之CPU排程策略和CPU親和性Linux
- Oracle優化案例-緊急處理一條sql引起cpu使用率99%的問題(十六)Oracle優化SQL
- RAC節點hang住, oracle bug導致了cpu過高,無法啟動叢集隔離Oracle
- CPU散片是什麼意思?盒裝CPU和CPU散裝的區別知識科普
- CPU設計——CPU核解析——cv32e40p
- iPhone CPU架構iPhone架構
- Understanding Linux CPU statsLinux
- cpu親緣性
- Java cpu 高排查Java
- CPU的散片和盒裝CPU有什麼區別?
- this kernel requires an x86-64 cpu,but only detected an i686 cpuUI
- 【知識分享】伺服器CPU和家用CPU的區別伺服器
- CPU入門掃盲篇之一文搞懂多 CPU、多核 CPU、超執行緒技術、SMP執行緒
- win10空閒cpu很多cpu佔滿怎麼辦 win10cpu佔用率高怎麼辦Win10
- CPU DIY裝機618電商節值得買的CPU推薦
- CPU Turbo和GPU Turbo的區別 CPU Turbo是什麼意思?GPU
- 電腦cpu是什麼意思 cpu處理器功能介紹