As SQL developers, we tend to think of performance tuning in terms of crafting the best table indices, avoiding scalar and table valued functions, and analyzing query plans (among other things). But sometimes going back to the spec and applying some properties of elementary math can be the best way to begin to improve performance of SQL queries which implement mathematical formulas. This article is a case study of how I used this technique to optimize my SQL implementation of the Inverse Simpson Index.
Even if your scalar function doesn’t touch tables, it still cripples performance by forcing serial processing, blowing up your CPUs, and obfuscating your query plans. Scalar user-defined functions: not even once.
This post provides new information about the preconditions for minimally logged bulk load when using INSERT...SELECT into indexed tables.
If someone sends you a cached plan that’s slow, how can you tell if it’s because of parameter sniffing?
Bert Wagner summarizes 12 techniques he's learned over time, from trial and error, for rewriting queries to improve performance.