>> It's mostly I/O cost, with a little bit CPU cost, for 10g and up.
>
> 记得这个是要设置一些参数的,但是绝大部分企业是没有设置这些参数,也就是说基本上只使用IO来计算COST [/quote]
Note I said 10g and up. You don't need to set any parameter. System cost is enabled by default. Here's an example in 10.2.0.4:
SQL> explain plan for select * from large;
Explained.
SQL> @?/rdbms/admin/utlxpls
PLAN_TABLE_OUTPUT
---------------------------------------------------------------------------
Plan hash value: 3398668370
---------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1972K| 169M| 12798 (1)| 00:02:34 |
| 1 | TABLE ACCESS FULL| LARGE | 1972K| 169M| 12798 (1)| 00:02:34 |
---------------------------------------------------------------------------
I didn't set any special parameter. The %CPU part is non-zero. In fact, you can't avoid CPU cost except by using hint no_cpu_costing or the undocumented parameter _optimizer_cost_model. See section (2) at
http://yong321.freeshell.org/oranotes/SystemStats.txt
Yong Huang