• Eirikur Eiriksson (4/30/2015)


    sharonsql2013 (4/30/2015)


    Does datediff hinders performance in queries.

    I am trying to access the records and it takes almost 40 seconds to filter out of 180000 rows. Which is not much of a data...

    My only filter is where Time_Created < datediff(day,90,getdate())

    Is there a better way to filter for past 90 days

    Quick thought, don't think it's the filter that is the main problem, can you post the actual query / execution plan?

    😎

    Op had the relationship backwards and was returning everything but the last 90 days.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)