A Resource Governor Request: Cap Total Query Memory Grants (Without Capping Other Stuff)

Easy Peas

I know what you’re gonna say: You’re gonna say, Erik, you can do this by setting the Maximum Memory Percent for each and every resource pool other than the internal one.

And I’ll tell you something wacky: That limits more than just total query memory grants, and all I want is an easy and straightforward way to tell SQL Server that I don’t want it to give up huge swaths of my buffer pool to query memory grants.

While the Memory Grant Percent setting makes it really easy to cap the total memory grant a single query can ask for, nothing does a singular job of controlling how much total memory queries can ask for as a whole, without also stifling other caches that contribute to Stolen Server Memory, like the plan cache. A very big thank you to LMNOP(b|t) for helping me figure that out.

The other downside is that you’d have to set that cap for each pool, and that’s exhausting. Tiresome. Easy to get wrong. It’d be a whole lot easier and cleaner to set that globally, without also nerfing a bunch of other potentially useful caches.

Thanks for reading!

Going Further

If this is the kind of SQL Server stuff you love learning about, you’ll love my training. I’m offering a 75% discount on to my blog readers if you click from here. I’m also available for consulting if you just don’t have time for that and need to solve performance problems quickly.

4 thoughts on “A Resource Governor Request: Cap Total Query Memory Grants (Without Capping Other Stuff)

  1. Please forgive my english here, but I’m not entirely sure what you’re after.

    Each query can take up to 25% of total memory.
    So 4 rouge queries, and you’re stranded, right?

    Are you asking for a setting that says something like:
    Queries can take 42 GBs of RAM in total, and not a single byte more ?

Comments are closed.