是的,b.cont_id=a.cont_id的结果集很大,但是前面有限制条件:a.cont_id=12 另外如果语句1换成以下: select * from t_acct a,t_acct_item b where a.cont_id=12 and b.cont_id=a.cont_id; 查询速度会很快 t_acct_item是一个表,视图v_huafei_item是建立在t_acct_item表之上的 请问高手是视图会造成什么影响吗?谢谢
用autotrace看看这两个语句的执行顺序就知道了
1.select * from t_acct a,v_huafei_item b where a.cont_id=12 and b.cont_id=a.cont_id;----> it should be faster if you do 1.select * from t_acct a,v_huafei_item b where b.cont_id=a.cont_id and a.cont_id=12
你的表的cont_id有没有索引。 还有就是表的记录和试图的纪录数哪一个多,以及两个记录数的数量级,是几百,还是几十万,几百万看看两个sql语句的执行计划,优化器是rbo,还是cbo 加上hint rule 看看 good luck
另外如果语句1换成以下:
select * from t_acct a,t_acct_item b
where a.cont_id=12 and b.cont_id=a.cont_id;
查询速度会很快
t_acct_item是一个表,视图v_huafei_item是建立在t_acct_item表之上的
请问高手是视图会造成什么影响吗?谢谢
where a.cont_id=12 and b.cont_id=a.cont_id;---->
it should be faster if you do
1.select * from t_acct a,v_huafei_item b
where b.cont_id=a.cont_id and a.cont_id=12
还有就是表的记录和试图的纪录数哪一个多,以及两个记录数的数量级,是几百,还是几十万,几百万看看两个sql语句的执行计划,优化器是rbo,还是cbo 加上hint rule 看看
good luck