Bug! Slow Sums and Averages

Posted by Paul White on SQL Blog See other posts from SQL Blog or by Paul White
Published on Sun, 27 Feb 2011 00:07:00 GMT Indexed on 2011/02/27 7:30 UTC
Read the original article Hit count: 422

Filed under:
It’s a curious thing about SQL that the SUM or AVG of no items is not zero, it’s NULL. In this post, you’ll see how this means your SUM and AVG calculations might run at half speed, or worse. As with most of my blog entries though, today’s instalment is not so much about the result, but the journey we take to get there. Before we get started on that, I just want to mention that there’s a problem with the Google Reader feed for this blog, so those of you that use that will have missed two recent entries: Seeking Without Indexes and Advanced TSQL Tuning: Why Internals Knowledge Matters. Accessing the site directly always works of course :) Ok, on to today’s story. Take a look at this query:...(read more)

© SQL Blog or respective owner