我想问一下达人:
我执行以下sql语句但运行速度很慢怎么优化它?
如下:
select
t.a,
t.b,
t1.a
from x@jbxx t,y t1,z t2,n t3
where t.a = t1.a
and t.a = t2.a and t.b is not null and t.a = t3.a
x@jbxx 是创建的DBLINK。有500W数据量 。我这样写运行速度很慢很慢。有什么方法优化它?
ps: 有人说把外面的条件放到里面。。我不会了。。
谢谢 各位 达人先。
我执行以下sql语句但运行速度很慢怎么优化它?
如下:
select
t.a,
t.b,
t1.a
from x@jbxx t,y t1,z t2,n t3
where t.a = t1.a
and t.a = t2.a and t.b is not null and t.a = t3.a
x@jbxx 是创建的DBLINK。有500W数据量 。我这样写运行速度很慢很慢。有什么方法优化它?
ps: 有人说把外面的条件放到里面。。我不会了。。
谢谢 各位 达人先。
这三个表的相关字段要设置正确的索引。
t.b is not null 换掉
不要使用is not null,效率极差。要想真正解决问题,给出执行计划。