■ Cost The cost assigned to each step of the query plan by the CBO. The CBO works by
generating many different execution paths/plans for the same query and assigns a cost to each and every one. The query plan with the lowest cost wins. In the full outer join example, we can see the total cost for this query is 10. ■ Card Card is short for Cardinality. It is the estimated number of rows that will flow out of a given query plan step. In the full outer join example, we can see the optimizer expects there to be 327 rows in EMP and 4 rows in DEPT. ■ Bytes The size in bytes of the data the CBO expects each step of the plan to return. This is dependent on the number of rows (Card) and the estimated width of the rows.·card是指计划中这一步所处理的行数。
·cost指cbo中这一步所耗费的资源,这个值是相对值,和cpu_cost、io_cost是有关系的。
参考《Apress.Troubleshooting.Oracle.Perforamnce》,chapter 4 system and object statistics。
cpu_cost=column_position*20(this formular is used to compute the cpu cost of accessing a column)
cost是由其他几个因素共同决定的,这里暂时不进行深入的研究。
一般情况下,在一张表只有一条记录的情况下,cpu_cost会有个初始值(常见的是2万多或3万多),随着记录的增加,cpu_cost也成比例的增加。
对于io_cost来说,如果访问的记录在一个db_block中,值是不变的。
·bytes指cbo中这一步所处理所有记录的字节数,是估算出来的一组值。
需要注意的是,在表记录数变更后,如果不执行DBMS_STATS.gather_table_stats统计的话,得到的cost等指标是不变的,也就是不准确的,只有重新统计一下表后,才能正确反应耗费的成本。