首页 新闻 会员 周边 捐助

C# Oracle PetaPoco

0
悬赏园豆:20 [已关闭问题] 关闭于 2018-05-23 10:25

C# 使用PetaPoco 连接Oracle进行参数化查询时执行很慢耗时快10几秒,而同样的sql 在 PL/SQL中执行不超过一秒。有哪位遇见过这种情况么?我是按时间条件进行筛选的,sql类似如下,代码中两个时间是参数化的。

select t.*
from (select r.sessionid sessionid, min(r.receivetime) receivetime
from ivr_msg r
left join ivr_msg_call msgCall on msgCall.Msgid = r.msgid
left join (select (case
when leg.answer_time is not null and
leg.answer_time is not null then
'0'
when leg.ring_time is not null and
leg.answer_time is null then
'1'
when leg.ring_time is null and
leg.answer_time is null then
'2'
else
'3'
end) as CausesFail,

                       m.msg_id MsgId
                  from ivr_msg_sync m
                  left join ivr_msg_call_sync ca on m.id = ca.taskid
                  left join ivr_call_leg_sync leg on ca.cuid =
                                                     leg.leg_uuid
                                                 and ca.telnumber =
                                                     leg.telnum) detail on r.msgid =
                                                                           detail.msgid
     where 1 = 1
       and r.receivetime >=
           to_date('2018-05-20 10:00:00', 'YYYY-MM-DD HH24:MI:SS')
       and r.receivetime <
           to_date('2018-05-23 10:00:00', 'YYYY-MM-DD HH24:MI:SS')
       and r.datatype = '21'
       and msgCall.Causesfail is null
       and detail.CausesFail is null
     group by r.sessionid) t

order by t.receivetime

GYY_顽石的主页 GYY_顽石 | 初学一级 | 园豆:143
提问于:2018-05-23 09:31
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册