Aggregates

External Article

Eager Aggregation in SQL queries

  • Article

Aggregation is a widely used way to summarize the content of a database. It is usually expressed with GROUP BY clause or just using aggregate functions (like COUNT or SUM). When the database engine executes a query with aggregations, it produces individual rows need to compute the required output and then performs the aggregation as (almost) last step. We discuss in this article how to re-write a query manually so that the order of operations will be different and when it can be beneficial.

2024-01-15

SQLServerCentral Article

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 (3)

You rated this post out of 5. Change rating

2021-05-07 (first published: )

5,377 reads

Blogs

A Conversation That Refused to End: What We Learned from Our First Event in Zurich

By

On May 8, 2025, we hosted our first official event in Switzerland at Prime...

A DevOps Workshop Tomorrow in Atlanta

By

Tomorrow is the Redgate DevOps Day in Atlanta. You can still sign up, so...

Stop Wasting Time Rebuilding Indexes Every Night

By

Too many IT teams run index rebuild jobs on autopilot. Every night. Every index....

Read the latest Blogs

Forums

Question on SQL Query with NOT condition

By mcfarlandparkway

I have a record, in those the three columns where firstname / last name...

Execution Plan Operators

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Execution Plan Operators

Merge spans with Dates Logic

By dhanekulakalyan

--for a given member if the startdate and endate is continous we need to...

Visit the forum

Question of the Day

Execution Plan Operators

When looking at an execution plan in SSMS, what types of operators are shown?

See possible answers