MS SQL INNER JOIN is taking very long time [closed]

Griffindor 1 Reputation point
2021-03-03T14:44:11.047+00:00

The below part of the CTE runs very very slow. When I look at the execution plan 78% of its cost goes to Nested Loops (Inner Join)

Are there any issue w.r.t performance in this query ? Below is JOIN that is consuming the memory

SELECT  
    D_HQ.Hour_Quarter_ID,  
    c_AP.PrevEvent,  
    c_AP.PrevEventTime,  
    c_AP.Event,  
    c_AP.Operator_ID,  
    c_AP.Zone_ID,  
    c_AP.Load_Unit_Id  
FROM  
    cte_Apply c_AP  
JOIN OA.DIM_Hour_Quarter D_HQ   
    ON c_AP.PrevEventTime >= D_HQ.Hour_Quarter_Start_Time  
    AND c_AP.PrevEventTime < D_HQ.Hour_Quarter_End_Time   
OPTION (MAXRECURSION 0)  

Part of the Execution Plan
73883-execution-plan.png
73819-details.png

Developer technologies | Transact-SQL
SQL Server | Other
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.