Troubleshooting Variable Memory Grants in SQL Server
Maira Leibius редагував цю сторінку 2 дні тому


One of the extra perplexing issues to troubleshoot in SQL Server can be those associated to memory grants. Some queries want more memory than others to execute, primarily based on what operations should be carried out (e.g. sort, hash). SQL Server’s optimizer estimates how much memory is required, and the question should get hold of the memory grant in order to begin executing. It holds that grant all through question execution - which means if the optimizer overestimates memory you can run into concurrency points. If it underestimates memory, then you possibly can see spills in tempdb. SEMAPHORE waits. There are a number of methods to assault this problem, and one in all my new favorite methods is to make use of Query Retailer. We are going to use a copy of WideWorldImporters that I inflated using the DataLoadSimulation.DailyProcessToCreateHistory saved procedure. The Sales.Orders desk has about 4.6 million rows, and the Sales.OrderLines desk has about 9.2 million rows. We’ll restore the backup and allow Question Retailer, and clear out any previous Question Store information so we don’t alter any metrics for this demo.


Retailer CLEAR