Core component of SQL Server for storing, processing, and securing data
The next checks should focus on proving whether this is truly a SQL Server 2022 scheduler change, or whether the regression is caused by environment differences or a changed execution plan despite the same compatibility level.
- Confirm the environments are comparable beyond the items already checked.
- Compare physical memory available to SQL Server.
- Compare CPU count, socket/core topology, and reported processor clock speed.
- Reconfirm the Windows power plan is High performance on both servers.
- Compare VMware configuration and host contention characteristics.
- Compare storage layout for data, log, and
tempdb, plus IOPS, throughput, and latency under a comparable workload. - Compare SQL Server version/build, database compatibility level, server configuration, and database-scoped configuration.
If clock speed or benchmark behavior is not comparable, investigate power plan, CPU allocation, virtualization layer, and host configuration first.Get-CimInstance Win32_Processor | Select-Object -Expand MaxClockSpeed - Verify the exact source and target engine details.
Run this on SQL Server 2022 and compare with the old SQL Server 2017 instance:
If the SQL Server version/build or compatibility level differs in any way, the regression should not be attributed to edition or scheduler behavior alone.SELECT SERVERPROPERTY('Edition') AS edition, SERVERPROPERTY('EngineEdition') AS engine_edition, SERVERPROPERTY('ProductVersion') AS product_version, SERVERPROPERTY('ProductLevel') AS product_level; SELECT name, compatibility_level FROM sys.databases WHERE name = DB_NAME(); - Treat
SOS_SCHEDULER_YIELDas evidence of CPU contention or worker pressure, not as proof of a scheduler defect. Check whether waits are accumulating significantly during the regression:SELECT wait_type, waiting_tasks_count, wait_time_ms FROM sys.dm_os_wait_stats WHERE wait_type IN ( 'SOS_SCHEDULER_YIELD', 'THREADPOOL' ) ORDER BY wait_time_ms DESC;- Large or rapidly increasing
SOS_SCHEDULER_YIELDwaits indicate CPU contention. -
THREADPOOLindicates worker exhaustion.
- Large or rapidly increasing
- Compare actual execution plans for the affected query between SQL Server 2017 and SQL Server 2022.
Even when the compatibility level remains 110, an engine change can still result in different execution plans. Inspect for:
- additional scans
- different join types
- increased or reduced parallelism
- increased estimated cost
- large cardinality estimation errors
- If the regression is limited to a few queries, test whether reverting the database to the previous compatibility behavior helps isolate optimizer-related regression. A documented approach after upgrade is to keep the old compatibility level first, enable Query Store, then move to the newer compatibility level and use Query Store to identify regressed queries or force the older plan as a short-term mitigation. In this case, compatibility level 110 is already being used, so the practical implication is: use Query Store and compare the regressed query’s plan and runtime behavior rather than assuming the scheduler is the root cause.
- If considering legacy CE testing, use only the supported scope and note the risk.
For SQL Server 2016 SP1 and later, query-level legacy CE can be tested with:
Database-level legacy CE can be tested with:SELECT * FROM Table1 WHERE Col1 = 10 OPTION (USE HINT ('FORCE_LEGACY_CARDINALITY_ESTIMATION'));
Risk: database-level or server-level CE changes affect all queries in scope, and queries that perform better with the default CE can regress.ALTER DATABASE SCOPED CONFIGURATION SET LEGACY_CARDINALITY_ESTIMATION = ON; SELECT name, value FROM sys.database_scoped_configurations WHERE name = 'LEGACY_CARDINALITY_ESTIMATION'; - If the query is repeatedly executed and spills or estimate errors are present, inspect memory grant behavior and Query Store feedback records.
For SQL Server 2022, compare estimated versus actual rows, join order, join types, and DOP. If Query Store is enabled, check
sys.query_store_plan_feedbackforCE FeedbackorDOP Feedback. A plan-shape difference alone does not prove that a feedback feature caused the regression.
The strongest supported conclusion is that the doubled Context Switches/sec does not, by itself, establish a SQL Server 2022 scheduler regression. The next supported path is:
- validate environment comparability again, especially storage and reported CPU characteristics
- compare exact engine/build details
- compare actual execution plans for the affected query
- use Query Store to identify whether the query regressed because of plan differences or feedback behavior
References:
- Troubleshoot performance problems after changing the SQL Server edition
- Decreased query performance after upgrade from SQL Server 2012 or earlier to 2014 or later
- ALTER DATABASE (Transact-SQL) compatibility level
- how to resolve degraded sql performance since upgrading from sql 2016 to sql 2022 - Microsoft Q&A