`

The CPU Costing Model: A Few Thoughts Part IV (Map of the Problematique)

    博客分类:
  • CBO
 
阅读更多

It’s called the CPU Costing model because among other things, it includes the time associated with performing CPU operations.
 
The CPU Costing model formula once again:
 
(sum of all the single block I/Os x average wait time for a single block I/O +
 sum of all the multiblock I/Os x average wait time for a multiblock I/O +
 sum of all the required CPU cycles / CPU cycles per second)
/
average wait time for a single block I/O
 

So the portion detailing the sum of all required CPU cycles divided by the CPU cycles per second can potentially contribute a significant proportion of the overall costs.
 
When I previously discussed the costs associated with the CPU model between using an index and a FTS, the FTS example I used had an overall cost of 70 but I calculated that the I/O component costs were only 67. Therefore the costs directly related to CPU operations with the FTS example was 3.
 
However, these CPU specific costs in this example may vary from database to database, although the FTS might be identical as might the required CPU cycles. However, a variable in all this is the CPU cycles per second system statistic (CPUSPEED) associated with a particular database environment.
 
Obviously, the faster the CPUs, the quicker it can perform the necessary CPU operations associated with the FTS (or any operation for that matter). Conversely, the slower the CPUs, the longer it will take to complete the necessary CPU related operations. The CPU costing model formula automatically takes all this into consideration.
 
In the previous example, the CPUSPEED system statistic was 1745.
 
Let’s now run the identical FTS but this time with a faster and a slower CPU and see how this might adjust the overall related costs when using the CPU costing model.
 
One can simulate a “faster” CPU by simply adjusting the CPUSPEED system statistic. Let’s make the CPUs appear 10 times faster:
 

SQL> exec dbms_stats.set_system_stats(pname=>’cpuspeed’, pvalue=>17450);
 
PL/SQL procedure successfully completed.
 

OK, let’s now see how this impacts the cost of the FTS:
 
SQL> SELECT * FROM bowie_stuff WHERE id = 420;
 
1000 rows selected.
 

Execution Plan
———————————————————-
Plan hash value: 910563088
 
——————————————————————-
|Id|Operation         |Name       |Rows|Bytes|Cost (%CPU)|Time    |
——————————————————————-
| 0|SELECT STATEMENT  |           |1000|18000|   67   (0)|00:00:01|
|*1| TABLE ACCESS FULL|BOWIE_STUFF|1000|18000|   67   (0)|00:00:01|
——————————————————————-
 

We notice that the overall cost has reduced from 70 down to 67. The cost of 3 that was previously attributed to just the CPU related costs have all disappeared and the costs are now just the 67 in relation to the I/O component.
 
The CPU is now so fast that it can effectively perform all the necessary operations in a negligible amount of time. An even faster CPU will not further improve the costs associated with this FTS as the costs now only include the I/O related components.

The (%CPU) value of (0) gives us this information if you didn’t follow how I derived the I/O cost of 67 in my previous post.

If we go the other way and now make the CPU about 1/10 the speed of the original example:
 
 
SQL> exec dbms_stats.set_system_stats(pname=>’cpuspeed’, pvalue=>175);
 
PL/SQL procedure successfully completed.
 
SQL> SELECT * FROM bowie_stuff WHERE id = 420;
 
1000 rows selected.
 

Execution Plan
———————————————————-
Plan hash value: 910563088
 
——————————————————————-
|Id|Operation         |Name       |Rows|Bytes|Cost (%CPU)|Time    |
——————————————————————-
| 0|SELECT STATEMENT  |           |1000|18000|   93  (28)|00:00:01|
|*1| TABLE ACCESS FULL|BOWIE_STUFF|1000|18000|   93  (28)|00:00:01|
——————————————————————-
 

We now notice the overall costs have jumped up considerably up from 70 up 93.
 
The costs associated directly with CPU activities have now increased up from 3 to 26. The CPU component is in the ballpark of 10 times as expensive/significant when you take into account rounding errors (the original 3 value was rounded accordingly). Remember also that these figures are times expressed in units of time it takes to perform a single block I/O.
 
The CPUs are now so slow that it takes a considerable amount of time to complete all the required CPU operations.
 
Note that the (%CPU) value is now a significant (28%) of the overall costs as derived from the following formula:

round(cpu related cost/total cost) x 100 = round(26/93 x 100) = 28.
 
So having a faster (or possibly slower) CPU when performing a hardware upgrade/change can result in potentially different execution plan costings (and as such different execution plans) when using the CPU CBO costing model.
 
It’s called the CPU costing model for a reason and as one would indeed hope, the speed of said CPU(s) can directly impact the associated costs and decisions made by the CBO.

 

参考至:http://richardfoote.wordpress.com/2010/01/07/the-cpu-costing-model-a-few-thoughts-part-iv-map-of-the-problematique/

如有错误,欢迎指正

邮箱:czmcj@163.com

分享到:
评论

相关推荐

    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 ...

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

    A clustered index is like a telephone directory in which all of the rows for customers with the same last name are clustered together in the same part of the book. Just as the organization of a ...

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

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

    Lean_manufacturing_Production_flow_and_activities_AX2012

    These refer to intermediate products that do not have a bill of materials (BOM) defined but are produced as part of a larger production flow. They are essential for managing work-in-progress (WIP) ...

    Pro PowerShell for Amazon Web Services DevOps for the AWS Cloud

    Tasks that traditionally took weeks of work, costing thousands of dollars, can be completed in minutes for a fraction of a penny. This book is a resource for using Microsoft's powerful scripting ...

    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 ...

    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...

    Shipment Costing.pdf

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

    oracle project costing manual

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

    Oracle成本管理培训资料.pptx

    **Unit IV: 分析和讨论** 最后,可能涉及实际案例分析和讨论,帮助学习者理解和应用学到的成本管理原则,解决实际业务问题。 在Oracle Cost Management中,费用项目的管理也是重要的一环。非库存费用项目和库存...

    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 对生命周期成本的概念...

    costing sheet

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

    APICS DICTIONARY

    **Definition**: The absentee rate is a ratio comparing the number of employee days lost due to absence with the total number of available employee workdays during a specified period, usually one month...

    Building a Game with Unity and Blender(PACKT,2015)

    In the wake of the indie game development scene, game development tools are no longer luxury items costing up to millions of dollars but are now affordable by smaller teams or even individual ...

    dynamic costing

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

    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...

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

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

    Beginning STM32: Developing with FreeRTOS, libopencm3 and GCC

    Beginning STM32 provides the professional, student, or hobbyist a way to learn about ARM without costing an arm! What You'll Learn Initialize and use the libopencm3 drivers and handle interrupts ...

    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