We have reports of performance issues on one of our applications. I tried to have a look for anything obvious, but I'm an Oracle DBA, and my SQL Server knowledge is pretty limited - we don't have any SQL Server DBAs or performance experts in house. So apologies for dumb questions! Version is SQL Server Enterprise 2017
It's made more complicated by the fact we have a lot of different databases on this cluster - thought the affected application is by far the busiest.
What did jump out at me was the very high number of ACCESS_METHODS_DATASET_PARENT latch waits - it was 99.5% of the latch waits, with 330 seconds of wait, per minute across 10 cores. If I'm reading the documentation correctly, that latch is used to control parallel table scans. Each wait was very small,0.002 seconds, but we are getting a huge number of them.
I had spotted that the MAX DOP was set to zero, and our server team spotted that the cpu allocation (It's running under VMWARE) wasn't correct - it was 10 1 core VCpus rather than a 10 core single cpu. So we changed it overnight to match up with https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/configure-the-max-degree-of-parallelism-server-configuration-option?view=sql-server-ver16#recommendations and set MAXDOP to 8, with the vcpu changes. Also increased the cost threshold for Parallelism from the default 5 to 25. It didn't seem to have much effect (though the average wait time seems to have come down)
What's confusing me is
- I'm not seeing parallel operations looking at 'expensive' queries real time via the activity monitor (Do Parallel scans happen 'under the hood'?)
- I'd have expected to see very high CPU utilisation - in Oracle the CPU would 'spin' while waiting on the latch. Does SQL Server just work differently?
- My gut reaction is that we shouldn't be using parallel query on what is mainly an OLTP system at all, I wouldn't in Oracle. But seems standard to just leave it in SQL Server and let it decide?
Questions,
- Am I just looking at the wrong thing here, and it's normal for SQL Server?
- If not, how do I find the queries responsible?
- Should I be going after the cause, not the symptom here i.e why are we doing table scans in the first place?
Any suggestions, gratefully received!