使用PL/SQL Developer 查看查询计划,显示了Cost 和 cardinality列,但是Cost 和 cardinality 容始终没有显示;
我的Oracle版本是9i,PL/SQL Developer帮助文档提示说:
Note: If you are using Oracle Server 7.2 or earlier, the cost and cardinality are not available in the plan
table. If you are using Oracle Server 7.3 or higher and cost and cardinality are not displayed, you
probably need to upgrade the plan table.
但是,怎么upgrade the plan table?
使用sqlPlus也不显示Cost 和 cardinality信息。
如何处理?望大家帮助。
我的Oracle版本是9i,PL/SQL Developer帮助文档提示说:
Note: If you are using Oracle Server 7.2 or earlier, the cost and cardinality are not available in the plan
table. If you are using Oracle Server 7.3 or higher and cost and cardinality are not displayed, you
probably need to upgrade the plan table.
但是,怎么upgrade the plan table?
使用sqlPlus也不显示Cost 和 cardinality信息。
如何处理?望大家帮助。
解决方案 »
- 索引查询需要什么条件,下面答案是B
- 寻求一本好的ORACLE书
- 在程序中执行oracle的增删改操作成功,但是为何在物理数据库中没数据
- 求ORA-01034 和ORA-27101解决办法
- OMS中连接局域网内其他计算机上oracke数据库的问题!!!
- 怎么改primary key的值没有foreign key (在线等待!)
- 关于oracle初始sga的设置
- 手里有一个 sql 文件,里面的内容都是创建表、序列、插入数据的 sql 语句,不知道怎么在oracle里去执行?谢谢
- 数据库不能打开,在线等待
- select 的用法
- oracle JOB 的设置问题
- 求助 ORACLE 执行UPDATE 很慢
在此情况下,如果你没对你的表进行统计信息收集,那么系统就会按照RULE来做执行计划。通常RULE下是不现实COST和cardinality的。当然也不是绝对的,比如你对一个分过区的表做执行计划 。你可以对你的系统收集一下统计信息,
dbms_stats.gather_table_stats
dbms_stats.gather_schema_stats
然后再做分析就会有cost等信息了。当然你也可以直接选取cost优化器,也能看到相应的信息。
不过,还有一个问题,在我的init.ora文件中,
#***********************************************************************
# Optimizer and query parameters
#***********************************************************************# All data warehouses should use the cost-based optimizer. All basic
# data warehouse performance features, such as star-query support,
# hash joins, parallel execution, and bitmap indexes are only
# accessible via the cost-based optimizer.
optimizer_mode = choose
默认的设置是choos, 如你所说,是不是如果我要启用CBO,必须要对系统收集一下统计信息?如果库里表很多,这样做也可以么?
其次,我是这样执行的:
begin
dbms_stats.gather_schema_stats(‘scott’);
end;
有没有什么标准点的方法和例子能够参考?
谢谢。