同样的sql,同样的表,由于执行计划的不同,会得到不同的结果集?

[复制链接]
查看11 | 回复4 | 2010-2-11 01:01:06 | 显示全部楼层 |阅读模式
同样的sql,同样的表,由于执行计划的不同,会得到不同的结果集?
回复

使用道具 举报

千问 | 2010-2-11 01:01:06 | 显示全部楼层
最初由 SHSUMMER 发布
[B]同样的sql,同样的表,由于执行计划的不同,会得到不同的结果集? [/B]

[PHP]
SQL> select /*+ full(t) */ object_name from t where rownumselect /*+ index(t) */ object_name from t where rownumselect /*+ full(t) */ object_name from t where rownumselect /*+ index(t) */ object_name from t where rownumselect object_name from t where rownumalter session set optimizer_mode = rule;
会话已更改。
SQL> select object_name from t where rownumselect /*+ full(t) */ object_name from t where rownumselect /*+ index(t) */ object_name from t where rownumselect /*+ full(t) */ object_name from dba_objects where rownum select /*+ index(t) */ object_name fromdba_objects where rownum select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE10.2.0.1.0Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
我怎么得不到yang斑竹的结果
回复

使用道具 举报

千问 | 2010-2-11 01:01:06 | 显示全部楼层
看来以后使用ROWNUM要注意了。呵呵
回复

使用道具 举报

千问 | 2010-2-11 01:01:06 | 显示全部楼层
最初由 棉花糖ONE 发布
[B]SQL> select /*+ full(t) */ object_name from dba_objects where rownum select /*+ index(t) */ object_name fromdba_objects where rownum select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE10.2.0.1.0Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
我怎么得不到yang斑竹的结果 [/B]

Youwould like to create table t and index on it.
回复

使用道具 举报

千问 | 2010-2-11 01:01:06 | 显示全部楼层
最初由 棉花糖ONE 发布
[B]SQL> select /*+ full(t) */ object_name from dba_objects where rownum select /*+ index(t) */ object_name fromdba_objects where rownum select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE10.2.0.1.0Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
我怎么得不到yang斑竹的结果 [/B]

直接查询dba_object应该不行吧。dba_object本来就是视图。
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行