<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Sql Server Performance on SQL Server Scripts</title><link>https://www.sqlserver70.com/tags/sql-server-performance/</link><description>Recent content in Sql Server Performance on SQL Server Scripts</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>SQLServer70.com</copyright><lastBuildDate>Wed, 28 Oct 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.sqlserver70.com/tags/sql-server-performance/index.xml" rel="self" type="application/rss+xml"/><item><title>Catch Plan Regressions Automatic Tuning Leaves Uncorrected</title><link>https://www.sqlserver70.com/post/catch-plan-regressions-automatic-tuning-leaves-uncorrected/</link><pubDate>Wed, 28 Oct 2026 00:00:00 +0000</pubDate><guid>https://www.sqlserver70.com/post/catch-plan-regressions-automatic-tuning-leaves-uncorrected/</guid><description>
&lt;p&gt;When the gap between a regressed plan and the last known good plan is &lt;a href="https://learn.microsoft.com/en-us/archive/blogs/sqlserverstorageengine/monitoring-automatic-tuning-actions-using-xevents"&gt;not high enough&lt;/a&gt;, automatic plan correction in &lt;a href="https://www.microsoft.com/en-us/sql-server"&gt;SQL Server&lt;/a&gt; leaves the regressed plan in place. The recommendation it records is lost at the next restart. The script below creates an Extended Events session that writes each detected but uncorrected regression to an event_file target on disk.&lt;/p&gt;
&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1012089347386563"
crossorigin="anonymous"&gt;&lt;/script&gt;
&lt;ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-1012089347386563"
data-ad-slot="8593449130"&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;h2 id="purpose-and-overview"&gt;Purpose and Overview&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/sql/relational-databases/automatic-tuning/automatic-tuning?view=sql-server-ver17"&gt;Automatic tuning was introduced in SQL Server 2017 (14.x)&lt;/a&gt;, and its plan correction feature forces the last known good plan when a query's plan regresses. Plan correction depends on Query Store being enabled in the database, and you turn it on per database with &lt;code&gt;ALTER DATABASE &amp;lt;yourDatabase&amp;gt; SET AUTOMATIC_TUNING ( FORCE_LAST_GOOD_PLAN = ON );&lt;/code&gt;. Once it is on, the engine forces any recommendation where the estimated CPU gain is higher than 10 seconds, or where the number of errors in the new plan is higher than in the recommended plan.&lt;/p&gt;</description></item></channel></rss>