我有一些查询可以为我提供一组数据。现在,在 2013 年之前,它们根据查询的数据量运行得与预期一样快。但现在它就像地狱一样慢。例子:
SELECT *
FROM (SELECT TOP 25 UserDetail,
isnull(ROUND(SUM(Cost), 2), 0) AS MixedCost
FROM PCounter.dbo.PrintJobsWithUserDetail
WHERE Month(PrintDate) = 1
AND Year(PrintDate) = 2013
GROUP BY UserDetail
ORDER BY MixedCost DESC) AS A
ORDER BY A.MixedCost ASC
现在,对于 Month = 1 Year = 2012,此查询在 2 秒内执行,而对于 2013,则需要 ¬3 分钟。
我要疯了吗?PS 每个月的数据量都差不多