我目前正在运行此查询:
SELECT Time_ID,
Site_Type_ID,
Abandoned_ID,
WorkType_ID,
SUM (staging.dbo.incoming_measure.ring_time) AS Ring_Time,
SUM (staging.dbo.incoming_measure.hold_time) As Hold_Time,
SUM (staging.dbo.incoming_measure.talk_time) AS Talk_Time,
SUM (staging.dbo.incoming_measure.acw_time) AS ACW_Time,
COUNT(*) CallCount
FROM incoming_measure
INNER JOIN DataMartEnd.dbo.Time_Dim
ON incoming_measure.StartTimeDate BETWEEN Time_Dim.Time_Start and
Time_Dim.Time_End
INNER JOIN datamartend.dbo.Site_Type_Dim
ON incoming_measure.DBID = Site_Type_Dim.Site_Type_Code
INNER JOIN datamartend.dbo.Abandoned_Call_Dim
ON incoming_measure.Abandoned = Abandoned_Call_Dim.abandoned_value
INNER JOIN DataMartEnd.dbo.Work_Type_Dim
ON incoming_measure.DBID = work_type_dim.MIG_Site_ID AND
Work_Type_Dim.Work_Type_Code = incoming_measure.Queue AND
incoming_measure.StartTimeDate BETWEEN Work_Type_Dim.DimEffectiveStartDtm AND
Work_Type_Dim.DimEffectiveEndDtm
group by time_id, Site_Type_ID, Abandoned_ID, WorkType_ID
它返回正确的结果,但运行大约需要 8 分钟,我只是想知道是否有人对我如何加快查询有任何建议?主要问题是如果这是我必须向客户展示最终结果的项目的一部分,并且我只能展示 10 分钟(大学规则),并且此查询约占项目的 30%。
估计执行的大部分是 SORT,占 57%。