优化sql 速度太慢 主要优化 or 求高手解决 急急急
selectt1.ID,t1.BUG_ID,t1.BUG_CODE,t1.BUG_OBJECT_TYPE,t1.S_K_CODE,t1.MODEL_ID,t1.DATA_...
select t1.ID,
t1.BUG_ID,
t1.BUG_CODE,
t1.BUG_OBJECT_TYPE,
t1.S_K_CODE,
t1.MODEL_ID,
t1.DATA_IDENTIFY,
t1.CORRECT_TYPE,
t1.X_TABLE_ID,
t1.PROPERTY_VALUE,
t1.PROPERTY_VALUE_TYPE,
t1.PROPERTY_CURRENT_VALUE,
t1.BUG_CORRECT_VALUE,
t1.BUG_IDENTITY_ID,
(select g.name
from xq_std_bug_identity g
where g.std_bi_id = BUG_IDENTITY_ID) BUG_IDENTITY_DESCRI,
t1.BUG_STEP,
t1.BUG_LEVEL,
t1.BUG_SQL,
t1.BUG_DEAL_MAN,
t1.DEAL_ADVISE,
t1.bug_dept_id,
t2.bug_id bug_source_incode,
t2.XQ_CODE,
t2.SOURCE_ID,
t2.SOURCE_CODE,
t2.SOURCE_TYPE,
t2.STATUS,
t2.XQ_CREATER,
t2.XQ_CREATE_DATE,
t2.XQ_DEAL_TIME,
t1.BUG_TYPE,
t2.FIND_TIME,
T2.XQ_DEPT_ID,
f_get_account_name(t1.BUG_DEAL_MAN) MAN_NAME,
(select g.model_name from dq_models g where g.id = t1.model_id) modelName,
t1.bug_busi_place_code
from xq_bugs t1, xq_bug_source t2
where t1.bug_id = t2.bug_id
AND (bug_busi_place_code in
(select t.dept_id
from rs_dept t
start with t.dept_id = 1
connect by t.upper_dept_id = prior t.dept_id) or
xq_dept_id in
(select t.dept_id
from rs_dept t
start with t.dept_id = 1
connect by t.upper_dept_id = prior t.dept_id))
order by FIND_TIME DESC 展开
t1.BUG_ID,
t1.BUG_CODE,
t1.BUG_OBJECT_TYPE,
t1.S_K_CODE,
t1.MODEL_ID,
t1.DATA_IDENTIFY,
t1.CORRECT_TYPE,
t1.X_TABLE_ID,
t1.PROPERTY_VALUE,
t1.PROPERTY_VALUE_TYPE,
t1.PROPERTY_CURRENT_VALUE,
t1.BUG_CORRECT_VALUE,
t1.BUG_IDENTITY_ID,
(select g.name
from xq_std_bug_identity g
where g.std_bi_id = BUG_IDENTITY_ID) BUG_IDENTITY_DESCRI,
t1.BUG_STEP,
t1.BUG_LEVEL,
t1.BUG_SQL,
t1.BUG_DEAL_MAN,
t1.DEAL_ADVISE,
t1.bug_dept_id,
t2.bug_id bug_source_incode,
t2.XQ_CODE,
t2.SOURCE_ID,
t2.SOURCE_CODE,
t2.SOURCE_TYPE,
t2.STATUS,
t2.XQ_CREATER,
t2.XQ_CREATE_DATE,
t2.XQ_DEAL_TIME,
t1.BUG_TYPE,
t2.FIND_TIME,
T2.XQ_DEPT_ID,
f_get_account_name(t1.BUG_DEAL_MAN) MAN_NAME,
(select g.model_name from dq_models g where g.id = t1.model_id) modelName,
t1.bug_busi_place_code
from xq_bugs t1, xq_bug_source t2
where t1.bug_id = t2.bug_id
AND (bug_busi_place_code in
(select t.dept_id
from rs_dept t
start with t.dept_id = 1
connect by t.upper_dept_id = prior t.dept_id) or
xq_dept_id in
(select t.dept_id
from rs_dept t
start with t.dept_id = 1
connect by t.upper_dept_id = prior t.dept_id))
order by FIND_TIME DESC 展开
2个回答
柚鸥ASO
2024-03-16 广告
2024-03-16 广告
「柚鸥ASO」在ASO这块就做的蛮不错的,一直专注于应用商店优化,因为专注所以专业;专注应用商店下载量优化、评分优化、关键词排名优化、关键词覆盖、产品权重提升等等整体方案优化服务柚鸥网络-全球ASO优化服务商专注ASO优化已11年!(效果说...
点击进入详情页
本回答由柚鸥ASO提供
展开全部
把in 换成exists 例如AND (exists
(select t.dept_id
from rs_dept t
start with t.dept_id = 1
connect by t.upper_dept_id = prior t.dept_id where bug_busi_place_code=t.相等的列)
该SQL的主要问题不在于or 在于In
(select t.dept_id
from rs_dept t
start with t.dept_id = 1
connect by t.upper_dept_id = prior t.dept_id where bug_busi_place_code=t.相等的列)
该SQL的主要问题不在于or 在于In
追问
速度还是那么慢 能否再优化下
追答
你这几个表里多少数据啊 如果再不行 你就将SQL重写吧 改成内嵌连接方式,最好把order by 去掉 如果不去掉 可以在排序列上加索引
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询