One interesting and useful new feature in SQL Server 2017 is Automatic plan correction. This feature relies on having Query Store enabled for your database. It will look for query plan choice regressions where there has been a significant regression based on CPU time for a given query. This feature essentially automates the usage of sp_query_store_force_plan for CPU-related plan regressions. Microsoft has more details about automatic tuning here.
One important detail that isn’t easy to find about automatic plan correction is whether it is available in SQL Server 2017 Standard Edition or not. We can easily confirm whether it is Enterprise-only feature with a simple test. You can do this by trying to enable the feature on a SQL Server 2017 Standard Edition instance, and see what happens.
You use the T-SQL shown in Figure 1 to enable automatic plan correction for the current database.
Figure 1: T-SQL to Enable Automatic Plan Correction in SQL Server 2017
As it turns out, this feature is not available unless you are using SQL Server 2017 Enterprise Edition, as you can see in Figure 2. This is another reason that you should prefer Enterprise Edition if your budget allows it.
Figure 2: Error Message from SQL Server 2017 Standard Edition
Yo can learn more about this feature by watching Erin Stellato’s Pluralsight course, SQL Server: Automatic Tuning in SQL Server 2017 and Azure SQL Database. You can also read her article on SQLPerformance.com, which is Automatic Plan Correction in SQL Server.