这个CPU为1是否表示消耗了总资源的1%

[复制链接]
查看11 | 回复2 | 2010-3-1 11:19:07 | 显示全部楼层 |阅读模式
这个(1)| 表示什么意思?我在客户的系统上发现很多执行计划都有CPU的信息(10G),但是我在我自己的机器上却没有发现一个执行计划有CPU的信息(10G)

------------------------------------------------------------------------------------
| Id | Operation | Name | Rows| Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 96 | 361 (1)| 00:00:04 |
| 1 | SORT AGGREGATE | | 1 | 96 | | |
| 2 | NESTED LOOPS | | 1 | 96 | 361 (1)| 00:00:04 |

是不是说用在CPU上的COST是占总COST的1%也就是3.6?
回复

使用道具 举报

千问 | 2010-3-1 11:19:07 | 显示全部楼层
When you have system stats (enabled by default and in fact it's hard to not have it in 10g), you'll have that.
I'm not sure about the actual number. It's probably documented somewhere but I didn't find it. Anybody knows?
If you keep doing:
explain plan for select * from [different size tables]
@?/rdbms/admin/utlxpls
select id, cost, cpu_cost from plan_table;
You may find a pattern. Maybe it's plan_table.cpu_cost divided by sys.aux_stats$.pval1 where pname = 'CPUSPEEDNW' or 'CPUSPEED'?
Yong Huang
[ 本帖最后由 Yong Huang 于 2010-4-6 15:36 编辑 ]
回复

使用道具 举报

千问 | 2010-3-1 11:19:07 | 显示全部楼层
In 9iR2 Performance Tuning Guide, and not in any other documentation, there's this CPU Costing Model:
http://download.oracle.com/docs/ ... 3/ex_plan.htm#19598
---------------- begin quote ----------------
Cost =(#SRds * sreadtim +
#MRds * mreadtim +
#CPUCycles / cpuspeed ) / sreadtim
where:
...
* #CPUCycles is the number of CPU Cycles *)
* sreadtim is the single block read time
...
* cpuspeed is the CPU cycles per second
CPUCycles includes CPU cost of query processing (pure CPU cost) and CPU cost of data retrieval (CPU cost of the buffer cache get).
---------------- end quote ----------------
Yong Huang
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行