优化查询语句

llin998 2006-03-15 11:57:02
select * from t_resource_cell where res_id in ( select c.res_id from t_resource_cell c inner join t_resource_type t on c.res_id = t.res_id where c.status != 'D' and c.mtype_id in (select mtype_id from d_resource_mtype where parent_id in ('RT') or mtype_id in ('RT') ) and ( (c.tmcp_id is not null and c.tmcp_id in ('BQ0007')) or (c.tmcp_id is null and c.res_id in ( select res_id from t_resource_tmcp where tmcp_id in ('BQ0007') ) ) ) and t.type1_id = '2100' and t.type2_id = '8100' )

请帮忙看看怎么能将这个查询优化一下!
...全文
116 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
cenlmmx 2006-03-15
  • 打赏
  • 举报
回复
这个基本没讨论的价值,没版本信息,没表的数据信息,哪种优化模式和执行计划...
bobfang 2006-03-15
  • 打赏
  • 举报
回复
select * from t_resource_cell c
where c.status != 'D'
and c.mtype_id in (select mtype_id from d_resource_mtype where parent_id in ('RT') or mtype_id in ('RT') )
and ( (c.tmcp_id is not null and c.tmcp_id in ('BQ0007') )
or (c.tmcp_id is null and c.res_id in ( select res_id from t_resource_tmcp where tmcp_id in ('BQ0007') ) ) )
and exists (select 1 from t_resource_type t
where c.res_id = t.res_id
and t.type1_id = '2100' and t.type2_id = '8100')
zlz_212 2006-03-15
  • 打赏
  • 举报
回复
in 操作看看是否可以替换成其他的,比如exists

17,090

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧