爽的翻 2018-09-18 02:59 采纳率: 66.7%
浏览 496
已采纳

sql 数据优化 pl/sql oracle

各位大佬下面语句有办法进行优化 让它的查询变得更快嘛

 Select a.*
  From (select /*+first_rows*/
         wi.iid as 顺序号,
         w.wname as 案件类型,
         i.name as 名称,
         x.联系人 as 联系人,
         wi.accepted_time as 接收时间,
         wi.submit_time as 提交时间,

         (Select user_name From st_user Where userid = wi.senduserid) as 前一用户,

         wi.wiid,
         wi.step as 所在岗位,
         x.业务类型id as BusinessId

          from ST_WORK_ITEM_HIST wi,
               xt_instance x,
               st_instance i,
               st_workflow w

         where wi.iid = x.iid
           and x.iid = i.iid
           and i.wid = w.wid
           and wi.userid = '52AD6F18BD6C45809A83D3D1EA4CC1F21111'
           and x.业务类型id in

               (select id from sys_business_type b where b.type = 3)
         order by wi.accepted_time desc) a

 Where rownum <= 10
  • 写回答

4条回答 默认 最新

  • 啊佛啊门 2018-09-18 03:09
    关注

    select /*+first_rows*/
    wi.iid as 顺序号,
    w.wname as 案件类型,
    i.name as 名称,
    x.联系人 as 联系人,
    wi.accepted_time as 接收时间,
    wi.submit_time as 提交时间,
    u.user_name as 前一用户,
    wi.wiid,
    wi.step as 所在岗位,
    x.业务类型id as BusinessId
    from ST_WORK_ITEM_HIST wi,
    xt_instance x,
    st_instance i,
    st_workflow w
    left join st_user u on u.userid=wi.senduserid
    where wi.iid = x.iid
    and x.iid = i.iid
    and i.wid = w.wid
    and wi.userid = '52AD6F18BD6C45809A83D3D1EA4CC1F21111'
    and exists (select 1 from sys_business_type b where b.type = 3 and b.id=x.业务类型id)
    order by wi.accepted_time desc

    推荐建立索引:
    ST_WORK_ITEM_HIST.iid
    xt_instance.iid
    st_instance.iid
    st_instance.wid
    st_workflow.wid

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 根据以下文字信息,做EA模型图
  • ¥15 删除虚拟显示器驱动 删除所有 Xorg 配置文件 删除显示器缓存文件 重启系统 可是依旧无法退出虚拟显示器
  • ¥15 vscode程序一直报同样的错,如何解决?
  • ¥15 关于使用unity中遇到的问题
  • ¥15 开放世界如何写线性关卡的用例(类似原神)
  • ¥15 关于并联谐振电磁感应加热
  • ¥60 请查询全国几个煤炭大省近十年的煤炭铁路及公路的货物周转量
  • ¥15 请帮我看看我这道c语言题到底漏了哪种情况吧!
  • ¥60 关机时蓝屏并显示KMODE_EXCEPTION_NOT_HANDLED,怎么修?
  • ¥66 如何制作支付宝扫码跳转到发红包界面