Description
This wait occurs when queries cannot be compiled because SQL Server is waiting for threads to become available. SQL Server caps the amount of queries that can be compiled at once. This wait is often present when the number of Availability Group or database mirrors is excessive. Small values typically do not cause an issue. If values are moderate or high then investigation is required
Resolved by
DBAs
Suggested solutions
- Decrease query complexity
- Appropriate indexing could reduce plan complexity
- Improve plan reuse (therefore compilation can be avoided)
- Increase the number of CPU cores available
Additional research
Thread Usage by Availability Groups
What is RESOURCE_SEMAPHORE_QUERY_COMPILE?