FIX: You may notice a large increase in compile time when you enable trace flags 2389 and 2390 in SQL Server 2005 Service Pack 1 (922063)



The information in this article applies to:

  • Microsoft SQL Server 2005 Service Pack 1

Bug #: 984 (SQL Hotfix)
Bug #: 441938 (SQLBUDT)

Notice

Microsoft distributes Microsoft SQL Server 2005 fixes as one downloadable file. Because the fixes are cumulative, each new release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2005 fix release.
This article describes the following about this hotfix release:
  • The issues that are fixed by this hotfix package
  • The prerequisites for installing the hotfix package
  • Information about whether you must restart the computer after you install the hotfix package
  • Information about whether the hotfix package is replaced by any other hotfix package
  • Information about whether you must make any registry changes
  • The files that are contained in the hotfix package

SYMPTOMS

Consider the following scenario. You are running SQL Server 2005 Service Pack 1 (SP1). You enable trace flags 2389 and 2390 to enable automatically generated quick statistics for ascending keys. In this scenario, you may experience the following behavior:
  • You notice a large increase in compile time.
  • SQL Server does not generate an efficient query plan because the correct maximum value for the column cannot be determined.

CAUSE

This problem occurs because SQL Server performs a scan of the appropriate column. This scan takes extra compile time.

RESOLUTION

A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Microsoft SQL Server 2005 service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Prerequisites

You must have SQL Server 2005 Service Pack 1 (SP1) installed to apply this hotfix.

For more information about how to obtain SQL Server 2005 SP1, click the following article number to view the article in the Microsoft Knowledge Base:

913089 How to obtain the latest service pack for SQL Server 2005

Restart information

You do not have to restart the computer after you apply this hotfix.

Registry information

You do not have to change the registry.

Hotfix file information

This hotfix contains only those files that are required to correct the issues that this article lists. This hotfix may not contain of all the files that you must have to fully update a product to the latest build.

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.SQL Server 2005 32-bit version
File nameFile versionFile sizeDateTimePlatform
Msgprox.dll2005.90.2174.0197,92017-Jul-200620:03x86
Msmdlocal.dll9.0.2174.015,701,79217-Jul-200620:04x86
Msmdredir.dll9.0.2174.03,967,77617-Jul-200620:03x86
Replprov.dll2005.90.2174.0547,61617-Jul-200620:05x86
Replrec.dll2005.90.2174.0782,11217-Jul-200620:02x86
Sqlaccess.dll2005.90.2174.0347,93617-Jul-200620:03x86
Sqlservr.exe2005.90.2174.028,951,89617-Jul-200620:04x86
Xpstar90.dll2005.90.2174.0292,12817-Jul-200620:03x86
SQL Server 2005 x64-based version
File nameFile versionFile sizeDateTimePlatform
Msgprox.dll2005.90.2174.0259,36018-Jul-200608:05x64
Msmdlocal.dll9.0.2174.015,701,79217-Jul-200620:04x86
Msmdredir.dll9.0.2174.03,967,77617-Jul-200620:03x86
Replprov.dll2005.90.2174.0745,24818-Jul-200608:06x64
Replrec.dll2005.90.2174.01,008,41618-Jul-200608:04x64
Sqlaccess.dll2005.90.2174.0355,10418-Jul-200608:05x86
Sqlservr.exe2005.90.2174.039,351,07218-Jul-200608:05x64
Xpstar90.dll2005.90.2174.0539,93618-Jul-200608:05x64
SQL Server 2005 Itanium architecture version
File nameFile versionFile sizeDateTimePlatform
Msgprox.dll2005.90.2174.0542,49617-Jul-200622:38IA-64
Msmdlocal.dll9.0.2174.048,828,70417-Jul-200622:39IA-64
Msmdredir.dll9.0.2174.06,154,01617-Jul-200622:39IA-64
Replprov.dll2005.90.2174.01,617,18417-Jul-200622:39IA-64
Replrec.dll2005.90.2174.02,141,47217-Jul-200622:39IA-64
Sqlaccess.dll2005.90.2174.0349,47217-Jul-200622:38x86
Sqlservr.exe2005.90.2174.072,235,29617-Jul-200622:40IA-64
Xpstar90.dll2005.90.2174.0950,04817-Jul-200622:36IA-64

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Ascending key columns can cause inaccurate statistics in tables that have frequent insert operations. These key columns may be IDENTITY columns or datetime columns that represent real-world time stamps. A common problem for some SQL Server applications are cases in which data typically ascends. For example, you have a table that contains a datetime column, and the column represents a current date. SQL Server builds statistics that assume that data will be mostly similar in the future. However, when data typically ascends, most new insertions are out of the previously found range. This behavior may cause poorly performing plans to be created. Filters that select recent data may exclude the whole relation even though a significant number of rows are included.

Trace flags 2389 and 2390 are both new in SQL Server 2005 SP1. These trace flags can help address this problem. SQL Server 2005 SP1 tracks the nature of columns by subsequent statistics updates. When SQL Server determines that the statistics increase three times, the column is branded ascending. The statistics will be updated automatically at query compile time if the following conditions are true:
  • Trace flag 2389 is set.
  • A column is branded ascending.
  • A covering index exists with the ascending column as the leading key.
A statement is compiled to find the highest value, and a new step is added at the end of the existing histogram to model the recently added data.

Trace flag 2390 enables the same behavior as trace flag 2389, even if the ascending nature of the column is not known. As long as the column is a leading column in an index, the optimizer updates the statistics that have the highest value at query compile time. Never use trace flag 2390 alone because this logic would be disabled as soon as the ascending nature of the column is known.

To enable automatically generated quick statistics for known ascending keys, run the following statement:
DBCC TRACEON ( 2389, -1 )
To enable automatically generated quick statistics for all columns that include known ascending keys or unknown ascending keys, run the following statement:
DBCC TRACEON ( 2389, 2390, -1 )
You can also use the -T command-line switch for Sqlservr.exe to enable these two trace flags server-wide . For more information, visit the following Microsoft Developer Network (MSDN) Web site: For more information about the naming schema for Microsoft SQL Server updates, click the following article number to view the article in the Microsoft Knowledge Base:

822499 New naming schema for Microsoft SQL Server software update packages

For more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates


Modification Type:MajorLast Reviewed:7/25/2006
Keywords:kbExpertiseAdvanced kbtshoot kbfix kbsql2005engine kbQFE kbhotfixserver kbpubtypekc KB922063 kbAudDeveloper kbAudITPRO