Question

On a SQL Server 2016 database server, I have few queries which are really slow and which ask for more memory (queries are not optimized). This is making the whole database slow as lots of users are running the same query. This is causing other queries to wait. I get CXCONSUMER wait (due to parallel execution) and RESOURCE_SEMAPHORE.

So this is creating memory pressure (I believe that these slow queries are creating memory contention for other queries and in turn creating memory pressure) and i think this is causing my plan cache to clear in fixed intervals.

I read that Memory Grant % by default is 25%. I am thinking of increasing this 25% to give memory for queries. I am trying to solve the problem temporarily for now.

The queries which are not optimized are LINQ queries and changing that will require some time for the team.

So please suggest whether increasing Memory Grant % in resource governor is a good idea or not?

I have total of 128GB RAM and 75% (102 GB) of it is allocated to SQL Server.

Was it helpful?

Solution

This is the opposite of what you should do.

When you have queries waiting on RESOURCE_SEMAPHORE, they're waiting for other queries to finish running, and give up their memory. The queries that are waiting aren't even running.

Letting all queries use more memory will only make the problem worse. You'd wanna configure resource governor to make queries ask for smaller grants. This could also cause problems, though, because any spills to disk would get worse.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top