FIX: CMEMTHREAD waits occur when you execute many ad hoc queries in SQL Server 2012 or SQL Server 2014

Symptoms
Assume that you have many statistics and tables and the tables contain many columns in a Microsoft SQL Server 2012 or SQL Server 2014 database. When you execute many ad hoc queries to retrieve data from those tables concurrently, you may experience CMEMTHREAD waits during the execution.
Resolution

Cumulative Update information

The issue was first fixed in the following cumulative update of SQL Server. 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:
More information
When you compile or recompile a query in SQL Server 2012, the engine needs to get inputs from statistics histogram. We need to perform a system table scan and then load the specific histogram of the tables that are involved into memory or cache. These system table entries (for the statistics) are stored in the System Table cache (CACHESTORE_SYSTEMROWSET). The memory object that is used to create these entries in the cache is not partitioned, and is global.

Therefore, if you have concurrent memory allocations performed during this operation, you will encounter CMEMTHREAD waits on this memory object. This usually happens when you submit lots of queries that require compilation or recompilation.

This hotfix changes the global memory object to be partitioned so that concurrent memory allocations that use the System Table cache will not encounter contention and the CMEMTHREAD waits.

For more information about the similar issue, see KB 3026082: FIX: SOS_CACHESTORE spinlock contention on system table rowset cache causes high CPU usage in SQL Server 2012 or 2014.
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Properties

Article ID: 3074425 - Last Review: 08/17/2015 19:09:00 - Revision: 3.0

Microsoft SQL Server 2012 Service Pack 2, Microsoft SQL Server 2014 Service Pack 1

  • kbqfe kbsurveynew kbfix kbexpertiseadvanced KB3074425
Feedback