FIX: CMEMTHREAD waits occur when you execute many ad hoc queries in SQL Server 2012 or SQL Server 2014
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.
Cumulative Update informationThe issue was first fixed in the following cumulative update of SQL Server.
- Cumulative Update 2 for SQL Server 2014 SP1
- Cumulative Update 9 for SQL Server 2014
- Cumulative Update 7 for SQL Server 2012 SP2
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:
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.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
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