FIX: Query runs slowly when SQL Server uses hash aggregate in the query plan

Your query may run slowly if the following conditions are true:
  • The query uses aggregates such as group by.
  • SQL Server uses hash aggregate in the query plan.
  • The estimated number of distinct values is much lower than the actual number of distinct values for the aggregate.
When this issue occurs, you will see a hash warning Event if you do Profiler or Extended Event tracing.

This issue occurs because SQL Server underestimates the amount of memory grant needed. This results in intermiedate results spilling to tempdb.
The issue was first fixed in the following cumulative update of SQL Server: Note You have to enable trace flag 9410 to activate this fix.

Recommendation: Install the latest cumulative update for SQL Server
Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. We recommend that you download and install the latest cumulative updates for SQL Server:
Learn about the terminology that Microsoft uses to describe software updates.
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.

رقم الموضوع: 3167159 - آخر مراجعة: 09/22/2016 03:59:00 - المراجعة: 3.0

Microsoft SQL Server 2014 Service Pack 1, Microsoft SQL Server 2016 Developer, Microsoft SQL Server 2016 Enterprise, Microsoft SQL Server 2016 Enterprise Core, Microsoft SQL Server 2016 Standard

  • kbqfe kbsurveynew kbexpertiseadvanced kbfix KB3167159