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

On This Page

Symptoms

When you try to build an index (by using CREATE INDEX or ALTER INDEX) on a spatial data type of a large table in Microsoft SQL Server 2012, the contention is high on the CMEMTHREAD wait type, and the performance of SQL Server decreases.

Resolution

The issue was first fixed in the following cumulative update of SQL Server.

Cumulative Update 7 for SQL Server 2012 SP1

About cumulative updates for SQL Server

Collapse this imageExpand this image
assets folding start collapsed
Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:
Collapse this imageExpand this image
assets folding end collapsed

Hotfix update package 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 this specific problem.

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, submit a request to 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.

More information

A CMEMTHREAD wait type indicates the wait on the internal, thread-safe memory objects. Higher levels of query parallelism may trigger the wait that leads to decreased performance of the spatial activity.

This fix partitions the CMEMTHREAD that associates with the "Spatial Memory Object" by using NUMA node partitioning. This reduces the worker activity concurrency to the number of schedulers active on a single node. For systems with higher levels of schedulers per node, trace flag –T8048 can be used to further partition all memory objects that allow partitioning by scheduler. Use the trace flag carefully, as it introduces a small amount of memory overhead to all NUMA node-partitioned memory objects.

Note The spatial memory object is created when the SqlServerSpatial110.dll is loaded into the SQL Server process address space. In most conditions, this requires a restart of the SQL Server process in order to apply the trace flag effects.

The CMEMTHREAD wait type is incremented for any thread safe memory object wait, not just the spatial object. The following XEvent session definition and use of public symbols can be used to identify the specific code line that is generating CMEMTHREAD waits:
CREATE EVENT SESSION wait_stacks
ON SERVER
ADD EVENT sqlos.wait_info
(
      action(package0.callstack) 
      where opcode = 1              -- wait completed
            and wait_type = 191          --     CMEMTHREAD
)
add target package0.asynchronous_bucketizer (SET source_type = 1, source = 'package0.callstack'),
add target package0.ring_buffer (SET max_memory = 4096)
With (MAX_DISPATCH_LATENCY = 1 SECONDS)
Go
alter event session wait_stacks on server state = start
go
 
Run the repro
 
select event_session_address, target_name, execution_count, cast (target_data as XML)
from sys.dm_xe_session_targets xst
      inner join sys.dm_xe_sessions xs on (xst.event_session_address = xs.address)
where xs.name = 'wait_stacks'
go

Status

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

Properties

Article ID: 2887888 - Last Review: November 18, 2013 - Revision: 2.0
Applies to
  • Microsoft SQL Server 2012 Service Pack 1, when used with:
    • Microsoft SQL Server 2012 Developer
    • Microsoft SQL Server 2012 Enterprise
    • Microsoft SQL Server 2012 Standard
Keywords: 
kbautohotfix kbqfe kbhotfixserver kbfix kbsurveynew kbexpertiseadvanced KB2887888

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