FIX: Poor performance when worktables that are marked for deferred drop are cleaned up in SQL Server 2008 R2

Van toepassing: SQL Server 2008 R2 DatacenterSQL Server 2008 R2 DeveloperSQL Server 2008 R2 Enterprise

Microsoft distributes Microsoft SQL Server 2008 R2 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 2008 R2 fix release.

Symptoms


Consider the following scenario:
  • You have a high-performance computer that has many processors. For example, the computer has 32 physical CPUs and 512 gigabytes (GB) of RAM.
  • The computer is running Microsoft SQL Server 2008 R2.
  • An application that is running on the server executes queries that create many worktables in the tempdb database.
In this scenario, you may receive an error message that resembles the following in the SQL Server error log:

Additionally, the USERSTORE_SCHEMAMGR SQL Server cache has many entries and grows quickly.

Cause


This issue occurs when many worktables are marked for deferred drop. When many worktables are marked for deferred drop, the clean-up process may take a very long time to finish.

Resolution


Cumulative update information

SQL Server 2008 R2 Service Pack 1

The fix for this issue was first released in Cumulative Update 1 for SQL Server 2008 R2 Service Pack 1. For more information about how to obtain this cumulative update package, click the following article number to view the article in the Microsoft Knowledge Base:
2544793 Cumulative Update package 1 for SQL Server 2008 R2 Service Pack 1
Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 R2 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
2567616 The SQL Server 2008 R2 builds that were released after SQL Server 2008 R2 Service Pack 1 was released

SQL Server 2008 R2

The fix for this issue was first released in Cumulative Update 5. For more information about how to obtain this cumulative update package for SQL Server 2008 R2, click the following article number to view the article in the Microsoft Knowledge Base:
2507770 Cumulative Update package 7 for SQL Server 2008 R2
Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 R2 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
981356 The SQL Server 2008 R2 builds that were released after SQL Server 2008 R2 was released

SQL Server 2008

To resolve this problem, obtain the latest service pack for SQL Server 2008. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
968382 How to obtain the latest service pack for SQL Server 2008


Hotfix information

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing the problem described in this article. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.


If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, contact Microsoft Customer Service and Support to obtain the hotfix.


Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft website:
Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.


Prerequisites

To apply this hotfix, you must have Microsoft SQL Server 2008 R2 installed.

Restart requirement

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

Hotfix replacement information

This hotfix does not replace a previously released hotfix.

File information

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.

For all supported 32-bit SQL Server 2008 R2 Database Services Core Instances
File nameFile versionFile sizeDateTimePlatform
Atxcore.dll2009.100.1766.026,46424-Feb-201101:49x86
Datacollectorcontroller.dll2009.100.1766.0135,52024-Feb-201101:49x86
Etwcls.mofNot applicable1,116,32822-Feb-201114:29Not applicable
Instmsdb.sqlNot applicable2,241,26022-Feb-201112:53Not applicable
Mssqlsystemresource.ldfNot applicable524,28822-Feb-201115:01Not applicable
Mssqlsystemresource.mdfNot applicable63,569,92022-Feb-201115:01Not applicable
Rsfxft.dll2009.100.1766.021,34424-Feb-201101:44x86
Sql_engine_core_inst_keyfile.dll2009.100.1766.013,66424-Feb-201101:45x86
Sqlaccess.dll2009.100.1766.0415,58424-Feb-201101:44x86
Sqlagent.exe2009.100.1766.0367,96824-Feb-201101:49x86
Sqlagent100_msdb_upgrade.sqlNot applicable2,371,24522-Feb-201114:28Not applicable
Sqlos.dll2009.100.1766.014,68824-Feb-201101:37x86
Sqlscriptdowngrade.dll2009.100.1766.014,68824-Feb-201101:37x86
Sqlscriptupgrade.dll2009.100.1766.04,611,42424-Feb-201101:37x86
Sqlservr.exe2009.100.1766.042,918,75224-Feb-201101:49x86
Sqsrvres.dll2009.100.1766.089,95224-Feb-201101:37x86
For all supported 64-bit SQL Server 2008 R2 Database Services Core Instances
File nameFile versionFile sizeDateTimePlatform
Atxcore.dll2009.100.1766.031,58424-Feb-201100:53x64
Datacollectorcontroller.dll2009.100.1766.0262,49624-Feb-201100:53x64
Etwcls.mofNot applicable1,116,32822-Feb-201114:29Not applicable
Instmsdb.sqlNot applicable2,241,26022-Feb-201112:53Not applicable
Mssqlsystemresource.ldfNot applicable524,28822-Feb-201115:01Not applicable
Mssqlsystemresource.mdfNot applicable63,569,92022-Feb-201115:01Not applicable
Rsfxft.dll2009.100.1766.025,44024-Feb-201100:50x64
Sql_engine_core_inst_keyfile.dll2009.100.1766.014,17624-Feb-201100:53x64
Sqlaccess.dll2009.100.1766.0403,29624-Feb-201100:50x86
Sqlagent.exe2009.100.1766.0428,38424-Feb-201100:53x64
Sqlagent100_msdb_upgrade.sqlNot applicable2,371,24522-Feb-201114:28Not applicable
Sqlos.dll2009.100.1766.015,71224-Feb-201100:50x64
Sqlscriptdowngrade.dll2009.100.1766.015,71224-Feb-201100:50x64
Sqlscriptupgrade.dll2009.100.1766.04,610,91224-Feb-201100:50x64
Sqlservr.exe2009.100.1766.062,019,42424-Feb-201100:53x64
Sqsrvres.dll2009.100.1766.0105,82424-Feb-201100:50x64
For all supported IA-64-based SQL Server 2008 R2 Database Services Core Instances
File nameFile versionFile sizeDateTimePlatform
Atxcore.dll2009.100.1766.063,32824-Feb-201100:18IA-64
Datacollectorcontroller.dll2009.100.1766.0477,02424-Feb-201100:18IA-64
Etwcls.mofNot applicable1,116,32822-Feb-201114:29Not applicable
Instmsdb.sqlNot applicable2,241,26022-Feb-201112:53Not applicable
Mssqlsystemresource.ldfNot applicable524,28822-Feb-201115:01Not applicable
Mssqlsystemresource.mdfNot applicable63,569,92022-Feb-201115:01Not applicable
Rsfxft.dll2009.100.1766.056,16024-Feb-201100:15IA-64
Sql_engine_core_inst_keyfile.dll2009.100.1766.019,29624-Feb-201100:18IA-64
Sqlaccess.dll2009.100.1766.0392,03224-Feb-201100:15x86
Sqlagent.exe2009.100.1766.01,206,11224-Feb-201100:21IA-64
Sqlagent100_msdb_upgrade.sqlNot applicable2,371,24522-Feb-201114:28Not applicable
Sqlos.dll2009.100.1766.022,36824-Feb-201100:12IA-64
Sqlscriptdowngrade.dll2009.100.1766.020,83224-Feb-201100:11IA-64
Sqlscriptupgrade.dll2009.100.1766.04,617,05624-Feb-201100:11IA-64
Sqlservr.exe2009.100.1766.0121,779,04024-Feb-201100:21IA-64
Sqsrvres.dll2009.100.1766.0188,76824-Feb-201100:11IA-64

Status


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

More Information


Worktables are internal tables that are created in the tempdb database and are not visible to users. SQL Server uses worktables for the following operations and objects:
  • Cursors
  • LOB variables (for example, Varchar(max))
  • Merge Joins
  • Parallel queries
  • Spool operators
  • XML document usage
  • Service Broker
  • Database consistency checks
SQL Server tries to drop the worktable when the specific work is completed. If the try fails, then the worktable is marked for cleanup (deferred drop). The background task that is responsible for Ghost record cleanup performs the cleanup of the deferred drop worktables.

When worktables are created frequently, the background task can take a long time to clean up the deferred drop worktables, and there may be many worktables in the cache. This cumulative update uses a more efficient algorithm to clean up the deferred drop worktables. Therefore, the issue that is described in the "Symptoms" section does not occur.

References


For more information about the naming schema for 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