SQL Server Performance

Simple Query taking 1.7 second to complete

Discussion in 'ALL SQL SERVER QUESTIONS' started by neerajmalik, Feb 5, 2014.

  1. neerajmalik New Member

    Code:
    SELECT Distinct
    
    RA.AResult,
    
    RA.NotAed,
    
    A.AtCode as PName,
    
    A.AtName,
    
    A.AtDimKey,
    
    RA.ABeginDate,
    
    RA.AEndDate,
    
    Case AWP When 1 then 'Y' else 'N' end,
    
    0,
    
    Case when NotAed = 1 then 'Not Available'
    
    When NotAed = 0 and AWP = 1 then 'Full'
    
    else 'Partial' end
    
    FROM FactRtsAvs RA (NOLOCK)
    
    join #tblRt F (NOLOCK) on (RA.ARtDimKey = F.RtsDimKey)
    
    join DimAts A (NOLOCK) on (RA.AAtDimKey = A.AtDimKey)
    
    Where
    
    ((RA.AcBeginDate between isnull(@TermSDate,'01/01/1900') and isnull(@TermEDate,'12/31/9999'))
    
    OR (RA.AcEndDate between isnull(@TermSDate,'01/01/1900') and isnull(@TermEDate,'12/31/9999'))
    
    OR (RA.AcBeginDate <= isnull(@TermSDate,'01/01/1900') And RA.AcEndDate >= isnull(@TermEDate,'12/31/9999'))
    
    )
    
    And RecordStatus = 0
    
    Hi there,

    Below is the query I am running at it is taking 1.7 seconds to finish. Can you please check see if I am doing anything wrong here.

    Thanks in advance!

Share This Page