Aggregates

Optimize Your SQL by Reformulating the Spec

  • Article

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.

5 (2)

2019-09-12

2,619 reads

Script to calculate the Median value for SQL Server data

  • Article

The standard SQL language has a number of aggregate functions like: SUM, MIN, MAX, AVG, but a common statistics function that SQL Server does not have is a built-in aggregate function for median. The median is the value that falls in the middle of a sorted resultset with equal parts that are smaller and equal parts that are greater. Since there is no built-in implementation for the median, the following is a simple solution I put together to find the median.

2011-11-08

2,817 reads

Blogs

Updated Data Profiling in Power BI Desktop

By

In this month’s (October 2019) release of Power BI Desktop, they have added a...

Power BI Monthly Digest – October 2019

By

In this month’s Power BI Digest with Manuel Quintana [Blog | Twitter] and I...

Database Fundamentals #24: Filtering Data

By

If you’ve been reading these Database Fundamentals posts, you’ve already seen the WHERE clause...

Read the latest Blogs

Forums

More Network Restrictions

By Steve Jones - SSC Editor

Comments posted to this topic are about the item More Network Restrictions, which is...

More Computed Column Indexes

By Steve Jones - SSC Editor

Comments posted to this topic are about the item More Computed Column Indexes

Using a Surrogate vs Natural Key

By steve@thesqlguy.com

Comments posted to this topic are about the item Using a Surrogate vs Natural...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers