我有以下查询
SELECT dbo.tblRegion.RegionName,
dbo.tblDistributionLocation.DistributionLocationName,
dbo.tblTSA.TSAName,
TEmailInfo.EmailCM,
COUNT(*) AS EmailCount
FROM dbo.tblArea
INNER JOIN dbo.tblTerritory
ON dbo.tblArea.AreaID = dbo.tblTerritory.AreaID
INNER JOIN dbo.tblDistribution
ON dbo.tblTerritory.TerritoryID = dbo.tblDistribution.TerritoryID
INNER JOIN dbo.tblDistributionLocation
ON dbo.tblDistribution.DistributionID = dbo.tblDistributionLocation.DistributionID
INNER JOIN dbo.tblRegion
ON dbo.tblArea.RegionID = dbo.tblRegion.RegionID
INNER JOIN dbo.tblTSA
ON dbo.tblDistributionLocation.DistributionLocationID =
dbo.tblTSA.DistributionLocationID
INNER JOIN dbo.tblTSAEmail
ON dbo.tblTSA.TSAID = dbo.tblTSAEmail.TSAID
INNER JOIN (SELECT *
FROM dbo.tblCMEvalEmail
WHERE ( dbo.tblCMEvalEmail.EmailSentDate
BETWEEN '2013-05-19 00:00:00' AND '2013-06-16 23:59:59' )) AS TCMEvalEmail
ON dbo.tblTSAEmail.TSAEmail = TCMEvalEmail.EmailSenderEmail
INNER JOIN (SELECT *
FROM dbo.tblCMEvalEmailInfo
WHERE dbo.tblCMEvalEmailInfo.EmailCMFacingDate
BETWEEN '2013-05-19 00:00:00' AND '2013-06-16 23:59:59') AS TEmailInfo
ON TCMEvalEmail.EmailID = TEmailInfo.EmailID
WHERE ( dbo.tblTSA.TSAActive = 1 )
AND TCMEvalEmail.EmailStatus = 'Success'
GROUP BY dbo.tblRegion.RegionName,
dbo.tblDistributionLocation.DistributionLocationName,
dbo.tblTSA.TSAName,
TEmailInfo.EmailCM
这个查询有什么问题需要这么多时间?
但是如果我缩短时间 '2013-05-20 00:00:00' 和 '2013-06-16 23:59:59' 那么它回复得很快。我的查询有什么问题需要这么多时间?