欢迎光临
我们一直在努力

ORA FAQ 性能调整系列之——Oracle 9与Oracle 8中CPU_COSTING有什么变化?-数据库专栏,ORACLE

建站超值云服务器,限时71元/月

what is the difference between cpu_costing in oracle 9 and the old costing of oracle 8 ?
oracle 9与oracle 8中cpu_costing有什么变化?

authors name: jonathan lewis
authors email: jonathan@jlcomp.demon.co.uk
date written: 15th dec 2002

oracle version(s): 9
what is the difference between cpu_costing in oracle 9 and the previous costing methods of oracle 7 and 8 ?
oracle 9与之前的oracle 7和8中cpu_costing有什么变化?

oracle 9 introduces a more subtle, and thorough costing mechansim. its a great improvement on the oracle 7/8 version, but i think the change-over is going to be a bit like the change-over from rule-based to cost-based. if you dont understand how it works you may see some strange events.
oracle 9 引入了一套更精细和全面的代价机制。这是对oracle 7/8版的重大改进,但我认为这一改变类似从基于规则转变至基于代价。如果你不理解它是如何运作的,你会看到奇怪的事件。

you can enable cpu_costing simply by collecting system_statistics for an appropriate period of time with the dbms_stats package. this records in the table sys.aux_stats$ values for:
你可以用dbms_stats包收集一段适当的时间内的系统统计,以此来激活cpu_costing。

 assumed cpu speed in mhz                       假定的cpu速度(mhz)
 single block read time in milliseconds         单块读时间(ms)
 multiblock read time in milliseconds           多块读时间(ms)
 typical achieved multiblock read.              一般达到的多块读

these figures are used to produce three main effects.
这些数字可产生三个主要效用:

instead of oracle assuming that single block reads are just as expensive as multiblock reads, oracle knows the relative speed. this is roughly equivalent to setting the parameter optimizer_index_cost_adj according to the db file xxxx read average wait times – it will encourage oracle to use indexed access paths instead of tablescans because oracle now understands that tablescans are more expensive than it used to think.
oracle并不假定单块读与多块读一样昂贵,它知道相对速度。这大致与根据数据库文件xxxx读取的平均等待时间设置参数optimizer_index_cost_adj相同——由于oracle现在认为表扫描比原先理解更昂贵,这将鼓励oracle使用索引访问路径而不是表扫描。

secondly, oracle will use the achieved average multiblock read count to calculate the number of read requests required to scan a table, instead of using an adjusted value of db_file_multiblock_read_count. since many people use a value of db_file_multiblock_read_count that is inappropriate, the result of this is that oracle is likely to increase the cost of, and therefore decrease the probability of, doing tablescans (and index fast full scans). note – the recorded value is used in the calculations, but oracle tries to use the init.ora value when actually running a tablescan.
其次,oracle将使用“达到的”(achieved)平均多块读取数来计算扫描一张表所需的读请求数,而不是使用一个db_file_multiblock_read_count的调整值。由于很多人使用的db_file_multiblock_read_count值并不合适,这样就造成oracle可能增加表扫描(和索引快速全扫描)的代价,并由此减少表扫描(和索引快速全扫描)的可能性。注意——记录的值是用于计算的,当真正进行扫描时,oracle会尝试使用init.ora中的值。

finally, oracle knows that (e.g.) to_char(date_col) = character value costs a lot more cpu than number_col = number_value, so it may change its choice of index to use a less selective index if the consequential cost of using that index is lower on cpu usage. (also, oracle will re-arrange the order of non-access predicates to minimise cpu costs, but the difference in performance from this is not likely to be visible in most cases).
最后,oracle知道(例如)to_char(日期列)=字符值的cpu代价比数字列=数值要打,所以oracle可能修改索引的选择,若使用一个有更小选择性的索引的连续读代价(consequential cost)低于cpu的使用代价,则会选择这一索引。(另外,oracle将重新安排非访问(non-access)的谓词顺序来减小cpu代价,但在多数情况下不会察觉性能的差异。)

overall – its definitely a good thing. in practice, you may see a much stronger bias towards indexed access paths which may impact performance.
总之——这肯定是一个好事。事实上,你可以发现对索引访问路径更强的偏好,这将影响性能。

further reading: oracle 9.2 performance tuning guide and reference
进一步阅读:oracle 9.2 性能调整指南和参考

——————————————————————————–
本文翻译自http://www.jlcomp.demon.co.uk/faq/  译者仅保留翻译版权

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » ORA FAQ 性能调整系列之——Oracle 9与Oracle 8中CPU_COSTING有什么变化?-数据库专栏,ORACLE
分享到: 更多 (0)