oracle 中sql执行超慢几乎查询不出来
selectLINKEDSTATIONfromrstationtwhere1=1andt.LinkedStationin(selectglobal_idfrombdz_a...
select LINKEDSTATION
from rstation t
where 1 = 1
and t.LinkedStation in
(select global_id
from bdz_app@linked bdz
where bdz.OBJ_ID in
(SELECT PZ.BDZ
FROM WHBZPZ@linked PZ
WHERE PZ.WHDW in (SELECT OBJ_ID
FROM DEPS@linked deps
where 1 = 1
START WITH OBJ_ID =
'63EBEC8E-00165'
CONNECT BY PRIOR OBJ_ID = SJBM))) 展开
from rstation t
where 1 = 1
and t.LinkedStation in
(select global_id
from bdz_app@linked bdz
where bdz.OBJ_ID in
(SELECT PZ.BDZ
FROM WHBZPZ@linked PZ
WHERE PZ.WHDW in (SELECT OBJ_ID
FROM DEPS@linked deps
where 1 = 1
START WITH OBJ_ID =
'63EBEC8E-00165'
CONNECT BY PRIOR OBJ_ID = SJBM))) 展开
4个回答
展开全部
套这么多层,而且用到DB LINK表那当然慢了
如果只执行一次最好把DB LINK的表创建一个中间表过来
再把这几个中间表联查速度会快多了
如果只执行一次最好把DB LINK的表创建一个中间表过来
再把这几个中间表联查速度会快多了
追问
但是我只执行and t.LinkedStation in后面的sql就很快
追答
后面SQL查出来有多少个结果集?超过一千个使用exists
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
select LINKEDSTATION from rstation t
left join bdz_app b on b.OBJ_ID =t.LinkedStation
left join WHBZPZ w on b.OBJ_ID =PZ.WHDW
left join DEPS d on PZ.WHDW = d.OBJ_ID
and d.OBJ_ID =' '63EBEC8E-00165''
left join bdz_app b on b.OBJ_ID =t.LinkedStation
left join WHBZPZ w on b.OBJ_ID =PZ.WHDW
left join DEPS d on PZ.WHDW = d.OBJ_ID
and d.OBJ_ID =' '63EBEC8E-00165''
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你写太多重的select了,可以考虑数据表连接查询
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询