Query Optimization Help

  • WHERE

     DATEADD(ss,-14400,PO_DATE) >=  '01/01/2005'

    AND

     DATEADD(ss,-14400,PO_DATE) <= '01/02/2005'

    GROUP BY

    With what i understand, the conditions above won't filter any dates. You can just get rid of the conditions above.

  • The dates mentioned in the example are just for example and the period is dynamically picked and it as has the time concatenated to it.

    Prasad Bhogadi
    www.inforaise.com

  • You should remove the DATEADD statements from the column side the statement.  The server can't use the indexes properly if you run a calculation on the indexed value.  Try something like this:

    WHERE 

     PO_DATE >=  DATEADD(ss,14400,'01/01/2005')

    AND 

     PO_DATE <= DATEADD(ss,14400,'01/02/2005')

    GROUP BY


    -Dan

Viewing 3 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply