我有一个使用视图的存储过程。存储过程接受各种参数。
我试过了:
SELECT
COUNT(v.CampaignID) as RecordCount
FROM
VW_Results_ValueRank_2010_12_22_NEW V
INNER JOIN
ResultTopic ON V.ResultID = ResultTopic.ResultId
INNER JOIN
CampaignTopic on ResultTopic.topicid = CampaignTopic.topicid
WHERE
v.CampaignID = 37
AND v.CreateDate BETWEEN 'May 3 2011 8:25PM' AND 'May 3 2012 8:25PM'
AND v.SourceDate BETWEEN DATEADD(d,-3,'May 3 2011 8:25PM') AND 'May 3 2012 8:25PM'
AND (LEFT(Title, 80) LIKE '%google%' OR Domain LIKE '%google%' OR LEFT([Text], 300) LIKE '%google%')
它返回 2016 年的记录,但需要 40-50 秒,我可以将这个时间减少到 5-10 秒吗?请帮忙。