Is SQL DATEDIFF(year, ..., ...) an Expensive Computation?
        Posted  
        
            by rlb.usa
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by rlb.usa
        
        
        
        Published on 2010-03-30T17:41:59Z
        Indexed on 
            2010/03/30
            17:53 UTC
        
        
        Read the original article
        Hit count: 321
        
I'm trying to optimize up some horrendously complicated SQL queries because it takes too long to finish.
In my queries, I have dynamically created SQL statements with lots of the same functions, so I created a temporary table where each function is only called once instead of many, many times - this cut my execution time by 3/4.
So my question is, can I expect to see much of a difference if say, 1,000 datediff computations are narrowed to 100?
© Stack Overflow or respective owner