When you try to execute multiple large queries at the same time in Microsoft SQL Server 2014, some queries may wait for RESOURCE_SEMAPHORE_QUERY_COMPILE. Only one query that requires more memory than the big gateway threshold (as provided by the output of the DBCC MEMORYSTATUS command) to compile can proceed, even if the server has sufficient memory available.
Note This is an expected behavior. However, in large batch systems such as a data warehouse, this could downgrade the performance in concurrent execution of many queries.
Cumulative Update information
The issue was first fixed in the following cumulative update of 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:
This hotfix introduces a new trace flag -T 6498. This trace flag lets more than one large query compilation gain access to the big gateway when there is sufficient memory available. It is based on the 80 percentage of SQL Server Target Memory, and it allows for one large query compilation per 25 gigabytes (GB) of memory. For example, this allows for two large query compilations on a 64 GB Target Memory computer.
After you apply this hotfix, you have to enable trace flag -T 6498 to enable the new behavior.
Note If you enable the trace flag by using the DBCC TRACEON command, you do not have to restart the server to have the trace flag take effect. But it may take 10 seconds for the new big gateway configuration to apply.
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.
CauseSQL Server uses the compile gateways to throttle compilations. The gateway architecture is a way for SQL Server to keep memory usage for the compilation of incoming queries under control. There are three gateways: small, medium and big.
For more information about how to use the DBCC MEMORYSTATUS command to monitor memory usage, see KB 907877: How to use the DBCC MEMORYSTATUS command to monitor memory usage on SQL Server 2005.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.