FIX: SQL Server 2008 R2 performs poorly when most threads wait for the CMEMTHREAD wait type if the threads use table variables or temp tables to load or update rowsets

Article translations Article translations
Article ID: 2492381 - View products that this article applies to.
Expand all | Collapse all

On This Page

SYMPTOMS

Consider the following scenario:
  • You install an instance of Microsoft SQL Server 2008 R2 on a computer.
  • The threads in this instance constantly wait for the CMEMTHREAD wait type. Most of the threads use table variables or temp tables to load or update rowsets. For example, most of the threads run one of the following statements:
    • CREATE TABLE
    • CREATE INDEX
  • The contention for the LOCK_HASH spinlock is high. For example, the spin count, the possible collisions, and the back-off values for the LOCK_HASH spinlock increase very fast.

    Note For more information about how to monitor the LOCK_HASH spinlock, see the "More information" section.
In this scenario, SQL Server 2008 R2 might perform poorly.

RESOLUTION

Cumulative update information

SQL Server 2008 R2

The fix for this issue was first released in Cumulative Update 6. 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:
2489376 Cumulative Update package 6 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

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:
http://support.microsoft.com/contactus/?ws=support
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 do not have to restart the computer after you apply this hotfix.

Hotfix replacement information

This hotfix does not replace any other 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.
32-bit SQL Server 2008 R2 Database Services Core Instance
Collapse this tableExpand this table
File name File version File size Date Time Platform
atxcore.dll 2009.100.1757.0 13,5520 8-Jan-11 0:37 x86
datacollectorcontroller.dll 2009.100.1757.0 135,520 8-Jan-11 0:36 x86
etwcls.mof Not applicable1,116,328 6-Jan-11 21:54 Not applicable
instmsdb.sql Not applicable2,241,260 6-Jan-11 20:23 Not applicable
mssqlsystemresource.ldf Not applicable524,288 6-Jan-11 23:51 Not applicable
mssqlsystemresource.mdf Not applicable63,569,920 6-Jan-11 23:51 Not applicable
sql_engine_core_inst_keyfile.dll 2009.100.1757.0 13,664 8-Jan-11 0:36 x86
sqlaccess.dll 2009.100.1757.0 415,584 8-Jan-11 0:34 x86
sqlagent.exe 2009.100.1757.0 367,968 8-Jan-11 0:37 x86
sqlagent100_msdb_upgrade.sql Not applicable2,371,245 6-Jan-11 21:52 Not applicable
sqlos.dll 2009.100.1757.0 14,688 8-Jan-11 0:25 x86
sqlscriptdowngrade.dll 2009.100.1757.0 14,688 8-Jan-11 0:25 x86
sqlscriptupgrade.dll 2009.100.1757.0 4,611,424 8-Jan-11 0:25 x86
sqlservr.exe 2009.100.1757.0 42,899,808 8-Jan-11 0:37 x86
sqsrvres.dll 2009.100.1757.0 89,952 8-Jan-11 0:25 x86
64-bit SQL Server 2008 R2 Database Services Core Instance
Collapse this tableExpand this table
File name File version File size Date Time Platform
atxcore.dll 2009.100.1757.0 31,584 7-Jan-11 23:36 x64
datacollectorcontroller.dll 2009.100.1757.0 26,2496 7-Jan-11 23:36 x64
etwcls.mof Not applicable1,116,328 6-Jan-11 21:54 Not applicable
instmsdb.sql Not applicable2,241,260 6-Jan-11 20:23 Not applicable
mssqlsystemresource.ldf Not applicable524,288 6-Jan-11 23:51 Not applicable
mssqlsystemresource.mdf Not applicable63,569,920 6-Jan-11 23:51 Not applicable
sql_engine_core_inst_keyfile.dll 2009.100.1757.0 14,176 7-Jan-11 23:36 x64
sqlaccess.dll 2009.100.1757.0 403,296 7-Jan-11 23:35 x86
sqlagent.exe 2009.100.1757.0 428,384 7-Jan-11 23:37 x64
sqlagent100_msdb_upgrade.sql Not applicable2,371,245 6-Jan-11 21:52 Not applicable
sqlos.dll 2009.100.1757.0 15,712 7-Jan-11 23:35 x64
sqlscriptdowngrade.dll 2009.100.1757.0 15,712 7-Jan-11 23:35 x64
sqlscriptupgrade.dll 2009.100.1757.0 4,610,912 7-Jan-11 23:35 x64
sqlservr.exe 2009.100.1757.0 62,007,648 7-Jan-11 23:37 x64
sqsrvres.dll 2009.100.1757.0 105,824 7-Jan-11 23:35 x64
Itanium-architecture SQL Server 2008 R2 Database Services Core Instance
Collapse this tableExpand this table
File name File version File size Date Time Platform
atxcore.dll 2009.100.1757.0 63,328 7-Jan-11 23:01 IA-64
datacollectorcontroller.dll 2009.100.1757.0 477,024 7-Jan-11 23:01 IA-64
etwcls.mof Not applicable1,116,328 6-Jan-11 21:54 Not applicable
instmsdb.sql Not applicable2,241,260 6-Jan-11 20:23 Not applicable
mssqlsystemresource.ldf Not applicable524,288 6-Jan-11 23:51 Not applicable
mssqlsystemresource.mdf Not applicable63,569,920 6-Jan-11 23:51 Not applicable
sql_engine_core_inst_keyfile.dll 2009.100.1757.0 19,296 7-Jan-11 23:01 IA-64
sqlaccess.dll 2009.100.1757.0 392,032 7-Jan-11 22:59 x86
sqlagent.exe 2009.100.1757.0 1,205,600 7-Jan-11 23:04 IA-64
sqlagent100_msdb_upgrade.sql Not applicable2,371,245 6-Jan-11 21:52 Not applicable
sqlos.dll 2009.100.1757.0 22,368 7-Jan-11 22:51 IA-64
sqlscriptdowngrade.dll 2009.100.1757.0 20,832 7-Jan-11 22:51 IA-64
sqlscriptupgrade.dll 2009.100.1757.0 4,617,056 7-Jan-11 22:51 IA-64
sqlservr.exe 2009.100.1757.0 121,714,528 7-Jan-11 23:04 IA-64
sqsrvres.dll 2009.100.1757.0 188,768 7-Jan-11 22:51 IA-64

STATUS

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

MORE INFORMATION

To monitor the LOCK_HASH spinlock, adjust the delay and number of iterations as appropriate for your environment in the following code, and then run that code:
SET NOCOUNT ON
CREATE TABLE #spins([Spinlock Name] varchar(50),Collisions numeric,Spins numeric,[Spins/Collision] float,[Sleep Time (ms)] numeric,Backoffs numeric, InsertTime datetime DEFAULT GETDATE())
DECLARE @counter int = 1
WHILE @counter < 10
      BEGIN
            INSERT INTO #spins ([Spinlock Name], Collisions, Spins, [Spins/Collision], [Sleep Time (ms)], Backoffs) EXECUTE ('DBCC SQLPERF (''SPINLOCKSTATS'') WITH NO_INFOMSGS')
            WAITFOR DELAY '00:00:05'
            SET @counter +=1
      END
SELECT * FROM #spins WHERE [Spinlock Name] = 'LOCK_HASH' ORDER BY InsertTime
DROP TABLE #spins

Properties

Article ID: 2492381 - Last Review: February 21, 2011 - Revision: 2.0
APPLIES TO
  • Microsoft SQL Server 2008 R2 Developer
  • Microsoft SQL Server 2008 R2 Enterprise
  • Microsoft SQL Server 2008 R2 Standard
  • Microsoft SQL Server 2008 R2 Standard Edition for Small Business
  • Microsoft SQL Server 2008 R2 Workgroup
Keywords: 
kbautohotfix kbqfe kbhotfixserver kbfix kbexpertiseadvanced kbsurveynew KB2492381

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com