zhenqingshi 2020-06-20 11:01 采纳率: 0%
浏览 618

oracle的涉及大数据量之查询语句优化

wtpart 表 数据量 千万级
stringvalue 表 数据量 十亿级
其他表均在百万级以下
限制:stringvalue字段无法建索引
问题:有时查询时间超30min
希望:提高查询效率

select ida2a2 as partId from (select rownum as rn,t.ida2a2
 from wtpart t inner join (
 select sv.ida3a4 from stringvalue sv
 join StringDefinition sd on sd.ida2a2=sv.ida3a6 
 where sd.name='figureno' and  sv.value like '0B' 
 )temp on temp.ida3a4=t.ida2a2 
 where t.versionida2versioninfo='A' and t.iterationida2iterationinfo='1'
  and t.ida3view=(select ida2a2 from wtview where name='EBOM')
    and  rownum<=50 )where rn>0

本地的执行计划
图片说明

  • 写回答

1条回答 默认 最新

  • 知了学飞 2020-06-22 09:07
    关注
    WITH W AS
     (select ida2a2 from wtview where name = 'EBOM'),
    temp AS
     (select sv.ida3a4
        from stringvalue sv, StringDefinition sd
       where sd.name = 'figureno'
         AND sd.ida2a2 = sv.ida3a6
         and sv.value like '0B')
    --看是否需要建这个索引:StringDefinition(ida2a2,name) 
    select ida2a2 as partId
      from (select rownum as rn, t.ida2a2
              from wtpart t, W
             where t.versionida2versioninfo = 'A'
               and t.iterationida2iterationinfo = '1'
               and t.ida3view = W.ida2a2
                        --关键点:把大表关联调整为存在性的判断
               and exists (select 1 from temp where temp.ida3a4 = t.ida2a2)
               and rownum <= 50)
     where rn > 0
    
    
    评论

报告相同问题?

悬赏问题

  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题