• sneumersky (12/14/2013)


    Somewhere your algebra 2 teacher is smiling......

    I wonder what the performance difference would be if these operations were done in the CLR vs T-SQL:

    a. In 2008

    b. In 2008 R2

    c. In 2012

    d. In 2014

    Would the difference be way less if the T-SQL operation was performed by natively compiled stored procedures accessing an in-memory table?

    Algebra 2? Actually we covered these formulas in 2nd grade :-P. As for the performance difference, it is faster (at least 50% (taking in to account memory, processors, etc.) in the CLR because of the compiled code. But here is a really good article and test scenario comparing T-SQL UDF vs. SQLCLR UDF. While the article focuses on splitting strings, it applies for any UDF process. By the way, we use Idera for all of our database (scripts included) performance measurements.

    http://blog.idera.com/sql-server/performance-and-monitoring/comparing-simple-efficiencies-t-sql-udf-vs-sqclr-udf-for-splitting-strings/

    Just as an FYI, this was asked of me years ago for some students in the 3rd grade. Basically, all the formulas were in UDF's (so the code was "clean") and had a ASP.NET front-end. Other UDF formulas I added were Arithmetic Series Summing, Geometric Series Summing and Mathematical Series.

    Anyway, I wanted to share an easy and fun QoTD.