查询代码中的SSRS参数衰减性能?

时间:2014-02-20 16:35:45

标签: reporting-services

我正在使用SQL Report Services构建一些报告。我有这个问题:

select 
FromPhone.PhoneUri as FROM_PHONE, 
Agente.UserUri as AGENTE,
IVRSession.InviteTime as INVITE,
AgenteSession.ResponseTime as RESPONSE_TIME, 
AgenteSession.SessionEndTime AS END_TIME,
DATEDIFF(SECOND,AgenteSession.ResponseTime, AgenteSession.SessionEndTime) as DURATA, 
DATEDIFF(SECOND,IVRSession.InviteTime, AgenteSession.ResponseTime) as ATTESA,
AgenteSession.ResponseCode as RESPONSE_CODE

from 
SessionDetails as IVRSession

join VoipDetails on IVRSession.SessionIdTime = VoipDetails.SessionIdTime and    IVRSession.SessionIdSeq = VoipDetails.SessionIdSeq
left outer join Phones as FromPhone on FromPhone.PhoneId = VoipDetails.FromNumberId
left outer join Phones as ConnectedPhone on ConnectedPhone.PhoneId = VoipDetails.ConnectedNumberId

join SessionDetails as AgenteSession on AgenteSession.ReplacesDialogIdTime = IVRSession.SessionIdTime and IVRSession.SessionIdSeq = AgenteSession.ReplacesDialogIdSeq


left outer join Users as User1 on User1.UserId = IVRSession.User1Id
left outer join Users as User2 on User2.UserId = IVRSession.User2Id
left outer join Users as Agente on Agente.UserId = AgenteSession.User1Id


left outer join ClientVersions as Client1Version on Client1Version.VersionId = IVRSession.User1ClientVerId
left outer join ClientVersions as Client2Version on Client2Version.VersionId = IVRSession.User2ClientVerId

    where


(Client1Version.ClientType = 1024 or Client2Version.ClientType = 1024) and
User2.UserUri = 'ivr0679071new@methodo.it' and
IVRSession.InviteTime > '15/01/2014' and IVRSession.InviteTime < '20/02/2014'

在这种形式下一切正常,但...... 如果我使用两个SSRS参数(@DataDa和@DataA)而不是

中的字符串
IVRSession.InviteTime > '15/01/2014' and IVRSession.InviteTime < '20/02/2014'

结果时间更长。像&gt;之类的东西1分钟

为什么这个行为???

1 个答案:

答案 0 :(得分:1)

您可能正在遭受参数嗅探。请参阅此处获取一个解释,尽管您可以在网络上找到大量有关此内容的信息 - https://www.simple-talk.com/sql/t-sql-programming/parameter-sniffing/