`

The CPU Costing Model: A Few Thoughts Part I

    博客分类:
  • CBO
 
阅读更多

In the coming days, I’ll post a series of little entries highlighting a specific point in relation to the use of system statistics and the CPU cost model. In myprevious post, we looked at how the cost of a FTS is calculated using the CPU costing model and how this generally results in an increase in the associated FTS cost over the I/O costing model.

The table in my demo though had an index with an appalling clustering factor and even though the cost of the FTS increased substantially from 33 to 70, this cost was still significantly less than the large cost associated with using such an inefficient index. So in that specific example, the change of FTS costs as introduced with the CPU costing model made no difference to the final execution plan.
 
The key point I want to emphasise with this post,  is that by increasing FTS costs as is common with the CPU costing model over the I/O costing model, this can of course potentially result in entirely different execution plans, especially if a candidate index has a reasonable clustering factor. Substantially increasing the associated costs of a FTS can be very significant, especially where the difference in costs between a FTS and an index can be much narrower for well clustered indexes.
 
In this previous I/O Costing Model example using the BOWIE_STUFF2 table, the index had an excellent clustering factor. However the query resulted in a FTS as the cost of 65 was just a little less than using an associated index:

SQL> select * from bowie_stuff2 where id in (20, 30, 40, 50, 60);
10000 rows selected.

 
Execution Plan
———————————————————-
Plan hash value: 573616353
——————————————————————
| Id | Operation | Name | Rows | Bytes | Cost |
——————————————————————
| 0 | SELECT STATEMENT | | 10000 | 175K| 65 |
|* 1 | TABLE ACCESS FULL| BOWIE_STUFF2 | 10000 | 175K| 65 |
——————————————————————

Remember, this was “addressed” and the CBO started using the index, by manually adjusting the optimizer_index_cost_adj parameter from its default value to a value of 75 as explained in this previous post on the effects of the optimizer_index_cost_adj parameter.

However, with system stats and the use of the CPU costing model, the extra FTS cost can have a direct impact on the resultant execution plan. Running the same query again, but this time without changing any optimizer parameters and using the same system stats as in my last post on the CPU Costing Model:

PNAME    PVAL1
-------- -----
SREADTIM     5
MREADTIM    10
CPUSPEED  1745
MBRC        10

SQL> select * from bowie_stuff2 where id in (20, 30, 40, 50, 60);
 
10000 rows selected.
 

Execution Plan
———————————————————-
Plan hash value: 2964430066
 
———————————————————————————————–
| Id  | Operation                    | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
———————————————————————————————–
|   0 | SELECT STATEMENT             |                | 10000 |   175K|       69(2)| 00:00:01 |
|   1 |  INLIST ITERATOR             |                |       |       |            |          |
|   2 |   TABLE ACCESS BY INDEX ROWID| BOWIE_STUFF2   | 10000 |   175K|       69(2)| 00:00:01 |
|*  3 |    INDEX RANGE SCAN          | BOWIE_STUFF2_I | 10000 |       |       25(0)| 00:00:01 |
———————————————————————————————–
 

We notice that the CBO has now chosen the index automatically, without having to make any changes to the optimizer_index_cost_adj parameter at all.
 
Previously, the FTS costs were 65. However, the current costs for a FTS are at least:
 
(ceil(blocks/mbrc) x mreadtime) / sreadtime = (ceil(659/10) x 10) / 5 = 132.
 
132 is already way greater than the 69 cost associated with using the above index and the 132 cost doesn’t even take into consideration any additional costs related to CPU usage.
 
So in general, using the CPU costing model will likely increase the associated costs of FTS, making indexes automatically more “attractive” to the CBO as a result. This change alone in how the FTS in particular is costed using the CPU costing model can have a major impact in execution plans chosen by the CBO. This is but one of the key reasons why things can change so dramatically when moving from 9i to 10g where the CPU costing model is the default.

 

参考至:http://richardfoote.wordpress.com/2009/12/08/the-cpu-costing-model-a-few-thoughts-part-i/
如有错误,欢迎指正
邮箱:czmcj@163.com

分享到:
评论

相关推荐

    200页详细的特斯拉Model3域控制器拆解分析

    8.Tesla Model 3域控制器 Reverse Costing 分析:通过对域控制器的Reverse Costing 分析,可以了解自动驾驶系统的成本结构和经济效益,了解自动驾驶系统的市场竞争力和商业战略。 9. 域控制器电子设计自动化(EDA)...

    Visual C# Homework Projects: A Computer Programming Tutorial

    To grasp the concepts presented in VISUAL C# HOMEWORK PROJECTS, you should possess a working knowledge of Windows and have had some exposure to Visual C# programming (or some other programming ...

    Shipment Costing.pdf

    根据提供的文档信息,本文将对SAP中的运输成本计算(Shipment Costing)进行详细的解析。主要内容包括SAP TM管理的定制设置、主数据配置以及流程演示等方面。 ### 一、简介 本文档旨在介绍SAP系统中运输成本计算的...

    oracle project costing manual

    标题《Oracle Project Costing Manual》表明本文档是关于Oracle项目成本管理的使用手册。文档描述指出,它用于指导Oracle项目成本管理系统的实施。标签“project costing”指明这是专门针对项目成本管理的专业内容。...

    costing sheet

    Costing Sheet - 成本核算单原理与后台配置 成本核算单(Costing Sheet)是一种重要的成本会计工具,用于计算和分配间接生产费用。它能够帮助企业更好地控制成本,提高生产效率和经济效益。 成本核算单的原理 ...

    dynamic costing

    动态成本(Dynamic Costing)是一种基于决策制定的成本管理方法,它强调根据不同的决策情境来定义和衡量成本。这种方法对于现代企业的财务管理至关重要,因为它可以帮助企业在不断变化的市场环境中做出更明智的决策...

    IEC 60300-3-3:2017 可靠性管理-第3-3部分:应用指南-生命周期成本计算 - 完整英文电子版(94页)

    完整英文电子版 IEC 60300-3-3:2017 Dependability management-Part 3-3:Application guide - Life cycle costing(可靠性管理-第3-3部分:应用指南-生命周期成本计算)。IEC 60300-3-3:2017 对生命周期成本的概念...

    微软内部资料-SQL性能优化5

    The trees are managed, and branches are grafted as necessary, so that navigating down the tree to find a value and locate a specific record takes only a few page accesses. Because the trees are ...

    Oracle成本管理培训资料.pptx

    **Unit I: 成本控制** Lesson 1 - Oracle 成本管理:Oracle系统提供了多种成本方法来适应不同企业的运营需求。这些方法包括: - 平均成本法(Inventory Average Costing):适用于仅库存组织,跟踪库存的平均成本...

    活动成本及活动activity based costing and activity based management.ppt

    活动成本及活动基础管理(Activity-Based Costing and Activity-Based Management,简称ABC/ABM)是管理会计中的核心概念,主要用于更准确地分配间接成本并优化决策制定。在现代企业环境中,间接成本通常占据了总...

    2015九年级英语全册Unit13We’retryingtosavetheearth第3课时同步练习新版人教新目标版

    - 9题:参加活动用take part in,选A. take part in。 - 10题:负担不起用can't afford,选A. afford。 4. 汉译英: - "当你出去的时候,不要忘记关灯。"译为"Don’t forget to turn off the lights when you go...

    Lean_manufacturing_Production_flow_and_activities_AX2012

    The document serves as a guide for those responsible for production, costing, or supply chain management. It aims to educate them on the range and scalability of the functionality offered by the lean ...

    Oracle Project Costing User Guide Release 11i

    《Oracle Project Costing 用户指南 11i 版》是Oracle公司发布的一份技术文档,主要作者包括Jeffrey Colvard、Stephen A. Gordon,以及多位贡献者。该指南旨在为用户详细阐述如何在Oracle Project Costing 11i版本中...

    Job Costing Tracking system:跟踪所有工作成本,确保您不会亏钱-开源

    预订工作卡,分配员工以记录在工作上花费的时间,该时间转移到时间表中,并添加成本,例如内置库存系统中的物料。 最后创建与XERO在线会计集成的发票或打印PDF发票。

    XML终极教程(PDF)

    the perspective of a software developer, but rather that of a Web-page author. I don’t spend a lot of time discussing BNF grammars or parsing element trees. Instead, I show you how you can use XML ...

    Pro PowerShell for Amazon Web Services DevOps for the AWS Cloud

    The cloud offers information technology workers significant cost savings and agility unimaginable even just a few years ago. Tasks that traditionally took weeks of work, costing thousands of dollars,...

    QAD Costing

    QAD Costing是QAD公司提供的一个专门针对产品成本管理和控制的解决方案。QAD Costing旨在帮助企业精确地计算和管理其产品的成本,从而优化运营效率,提高盈利能力,并作出更明智的决策。 产品成本法是QAD Costing的...

    Tanning Salon

    Research has shown that if a customer arrives and there are no beds available, the customer will turn around and leave, thus costing the company a sale. Your task is to write a program that tells the...

    Unit 5 Going shopping测试题及答案2.doc

    - the middle part:center(中心) - go well with:match(匹配) - very big:huge(巨大的) 在单项选择题部分,题目涉及了折扣、花费、介词的使用等: 1. 关于衣服的折扣,用on;以20%的折扣购买,用at。 2...

Global site tag (gtag.js) - Google Analytics