THE SQL Server Blog Spot on the Web

Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | |
in Search

Browse by Tags

All Tags » Query Plans » aggregates   (RSS)
  • Fun with Aggregates

    There are interesting things to be learned from even the simplest queries.  For example, imagine you are given the task of writing a query to list AdventureWorks product names where the product has at least one entry in the transaction history table, but fewer than ten. One possible query to meet that specification is: SELECT ...
    Posted to Paul White: Page Free Space (Weblog) by Paul White on March 11, 2012
  • Is Distinct Aggregation Still Considered Harmful?

    Back in 2008, Marc Friedman of the SQL Server Query Processor Team wrote a blog entry entitled “Distinct Aggregation Considered Harmful”, in which he shows a way to work around the poor performance that often results simply from adding the keyword DISTINCT to an otherwise perfectly reasonable aggregate function in a query.  This post is an ...
    Posted to Paul White: Page Free Space (Weblog) by Paul White on December 3, 2011
  • Why generalizations are dangerous

    A couple of years ago, John Sansom wrote a blog post comparing the performance of two different ways to get the maximum value from a column: MAX() and TOP (1). http://www.johnsansom.com/performance-comparison-of-select-top-1-verses-max/ In the conclusion, he states:  When a clustered index is present on the table & ...
    Posted to Aaron Bertrand (Weblog) by AaronBertrand on September 15, 2011
  • Row Goals and Grouping

    You might recall (from my last post) that query plans containing a row goal tend to favour nested loops or merge join over hashing.  This is because a hash join has to fully process its build input (to populate its hash table) before it can start probing for matches from its second input.  Hash join therefore has a high start-up cost, ...
    Posted to Paul White: Page Free Space (Weblog) by Paul White on August 22, 2010
  • Ranking Function Optimizer Transformations

    In my last post I showed how SQL Server 2005 and later can use a Segment Spool to efficiently implement aggregate window functions and the NTILE ranking function. The query optimizer is also smart enough to recognise that some queries are logically equivalent to a window function, even if they are written using different syntax.  As a ...
    Posted to Paul White: Page Free Space (Weblog) by Paul White on July 28, 2010
Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement