我的查询是否存在参数嗅探性能问题?我保留了查询执行计划建议的非聚集索引,但我仍然怀疑这是参数嗅探还是其他问题。请检查以下查询:
declare @orgid int=22,
@salesperson int=0
select
pd.col1,dd.col1
from t1 pd
inner join (select max(doId) doid,personId from t2 where productId=99 and personId>0
and effectDate IS NOT NULL group by personId) d on pd.personId=d.personId
join t2 dd on d.doid=dd.doId
join (select max(requestId) requestid,doId from t3 group by doId ) p on dd.doId=p.doId
join t3 pp on p.requestid=pp.requestIdjoin person prn on cp.personId=prn.personId
where pd.organizationId=@orgId
and (@salesperson=0 or cp.personId=@salesperson)
order by pd.patientName
这条线会引起问题吗?
(@salesperson=0 or cp.personId=@salesperson)