SQL Server 2017 introduced the system view known as sys.dm_db_tuning_recommendations, which displays all detected plan regressions. Using this view, you can retrieve data, compare the last known good plan with the regressed plan, and obtain the script to manually resolve the regression. I came across this article which helps identify bad parameter sniffing using sys.dm_db_tuning_recommendations system view.
This is very very helpful, unfortunately, it isn't available in SQL Server 2016 where Query Store was first introduced. Can I ask any help on how I can possibly query the same information using the DMV:
- Sys.query_store_query
- Sys.query_store_query_text
- Sys.query_store_plan
- Sys.query_store_runtime_stats
My goal is to identify regressed queries with more than 1 plan so I can compare the plans to choose which is the best plan to use. Basically the script format of the chart provided under regression queries but with more information.
sys,query_store...views and look for changes over time. TBH, I don't think that's worth anyone's time - it makes far better economic sense to buy an upgrade to SQL Server 2022 (assuming that(time (in hours) to build, test, verify, and use the query-regression tracker) * (dev cost per hour) > (cost of license upgrade from 2016 to 2022 )