ORA FAQ 性能调整系列之——Oracle 9与Oracle 8中CPU

oracle|性能

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

Author's name: Jonathan Lewis
Author's 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. It's 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 don't 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 - it's 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/  译者仅保留翻译版权

时间: 2024-08-03 15:17:47

ORA FAQ 性能调整系列之——Oracle 9与Oracle 8中CPU的相关文章

ORA FAQ 性能调整系列之——当索引第一列由序列产生,一个逆序索引有什么用?

索引|性能 ORA FAQ 性能调整系列之--The Oracle (tm) Users' Co-Operative FAQWhy would a reverse index be useful when the leading column of the index is generated from a sequence ?当索引第一列由序列产生,一个逆序索引有什么用?--------------------------------------------------------------

ORA FAQ 性能调整系列之——压缩索引会提高性能么?

索引|性能|压缩 Will compressing my indexes improve performance ?压缩索引会提高性能么? Author's name: Jonathan Lewis Author's Email: Jonathan@jlcomp.demon.co.uk Date written: 26th Feb 2003 Oracle version(s): 8.1 - 9.2 Compressed indexes have been around for a couple

oracle数据库的性能调整

oracle|数据|数据库|性能     oracle是一个高性能数据库软件.用户可以通过参数的调整,达到性能的优化.性能优化主要分为两部分:一是数据库管理员通过对系统参数的调整达到优化的目的,二是开发人员通过对应用程序的优化达到调整的目的. 在此,仅就系统参数的调整进行探讨,而不涉及应用程序的优化.对系统参数的调整,可以分为以下几个部分: (1)调整内存分配 系统全局区(SGA)是一个分配给ORACLE 包含ORACLE 数据库实例控制信息的内存段.SGA的大小对系统性能的影响极大,其缺省参数

ORACLE SQL性能优化系列 (一)

oracle|性能|优化 1. 选用适合的ORACLE优化器      ORACLE的优化器共有3种:    a.  RULE (基于规则)   b. COST (基于成本)  c. CHOOSE (选择性)      设置缺省的优化器,可以通过对init.ora文件中OPTIMIZER_MODE参数的各种声明,如RULE,COST,CHOOSE,ALL_ROWS,FIRST_ROWS . 你当然也在SQL句级或是会话(session)级对其进行覆盖.    为了使用基于成本的优化器(CBO,

ORACLE SQL性能优化系列 (六)

oracle|性能|优化 20.       用表连接替换EXISTS        通常来说 , 采用表连接的方式比EXISTS更有效率       SELECT ENAME       FROM EMP E       WHERE EXISTS (SELECT 'X'                       FROM DEPT                       WHERE DEPT_NO = E.DEPT_NO                       AND DEPT_CA

Oracle性能调整的指导纲要

讲优化时大致写的一个提纲,内容分db的物理设计和逻辑设计,主要以物理设计为主,逻辑设计介绍的内容不多,提纲里把物理结构设计和实例优化有机的结合在一起,把逻辑结构设计和应用调整结合在一起...... Oracle性能调整指导纲要 数据库物理结构设计和实例级别的调整 一.Oracle性能优化方法论 1.为什么(what)要优化(系统慢了?慢是表象) 2.怎样(how)优化?(需要找到慢的原因) a.是系统的问题? b.是数据库的问题? 3.谁(who)来优化? a.系统架构师(系统架构设计的有问题,

Oracle SQL性能优化系列讲座之一

1. 选用适合的ORACLE优化器 ORACLE的优化器共有3种: a. RULE (基于规则) b. COST (基于成本) c. CHOOSE (选择性) 设置缺省的优化器,可以通过对init.ora文件中OPTIMIZER_MODE参数的各种声明,如RULE,COST,CHOOSE,ALL_ROWS,FIRST_ROWS . 你当然也在SQL句级或是会话(session)级对其进行覆盖. 为了使用基于成本的优化器(CBO, Cost-Based Optimizer) , 你必须经常运行an

Oracle 9i在AIX上的性能调整

产品: AIX , Oracle 平台: pSeries, AIX 版本: ALL 内存访问的冲突出现在当进程申请的内存超过系统的物理内存总量时,为了处理这种情况,系统将程序与数据在内存和硬盘间进行交换. 控制内存交换操作(Paging) 大量的内存交换操作会极大地影响系统的性能,尤其是在当数据库文件创建在文件系统上时(JFS and JFS2).在这种情况下经常访问的数据,即在SGA中存在,也同样在文件的缓存中存在.这种相同的数据在内存中缓存两次的情况,会降低内存的使用效率,从而使内存频繁进行

Oracle性能调整与优化(二)

为了能取得圆满成功,我将涉及到一些预备步骤,它们将在查看发生了什么时需要,这些步骤包括运 行plustrce SQL脚本.创建一个"EXPLAIN_PLAN"表.授予角色.配置sql*plus环境查看执行计划.所有 这些步骤都包括在"Oracle 9i R2数据库性能调整指南和参考"中"在sql*plus中使用自动跟踪",对于 Oracle 10g,这些步骤包括在"sql*plus用户指南和参考10.2版"中"调整s