r/SQLServer • u/erinstellato Microsoft Employee • Jul 10 '26
Community Request Friday Feedback: Automatic Plan Correction
Hey folks! This week for a rather late Friday Feedback, I'm interested in your thoughts about Automatic Plan Correction. There are only a handful of feedback items on the site (aka.ms/sqlfeedback) but based on discussions with some customers, I think it's an area where we are due for some improvements. What are folks struggling with when it comes to using APRC?
7
Upvotes
2
u/BrentOzar Jul 11 '26
The big problem for me is unparameterized queries (or partially parameterized ones) that don’t get plan reuse. That happens with half of the servers I look at these days.
1
u/Dry_Author8849 Jul 11 '26
It doesn't work. We are still optimizing queries by hand.
For some reason SQL Server still makes bad decisions with set arithabort on/off. So the query store sees them as separate plans, a user with different options might get a horrible plan that won't be optimized by the query store. The better plan was with the other option set.
Cheers!
1
u/Black_Magic100 Jul 14 '26
Erin,
This feature is terrifying to us after we enabled it 5 years ago on one of our most active databases and it caused an outage during the day. I don't remember the full details, but that definitely scarred us and as a result we never attempted it again. Part of the problem is our environment and how complicated it is, so I'm not shocked it had an issue. Before this, we enabled it on dozens of other databases on the same server without issue.
Funny enough, we recently encountered an issue with a similar feature that I wasn't even aware of on 2022, which is the automatic CE feedback feature. This also caused an outage (CPU spiked to 100%) for a single query as the plan shifted as a direct result of applying ASSUME_JOIN_PREDICATE_DEPENDS_ON_FILTERS.
With these automatic tuning features, I love the idea, but the execution seems poor. Even if the feature fixes/helps 1000 other queries (difficult to prove), leadership only sees the bridge that it caused. I'm honestly quite shocked that the regression functionality didn't detect this plan shift and immediately roll it back, but it gives us the same vibe as that issue described above 5 years ago with automatic plan tuning.
So my advice to you (Microsoft) is to really focus on the rollback/safety functionality. I would much prefer stability in my environment than 100% effectiveness. Worded differently, err on the side of caution with these types of features. If the feature causes an outage, it's worthless to me and we are going to disable it.
1
u/shabos22 Oct 09 '26 edited Oct 09 '26
Automatic tuning from last friday becomes worse in my case.
It puts the simple query in forced plan These are queries joining 2 tables and having in clause however as running application data is added into these tables continues and autotuning putting the select queries in force plan and query is taking so much cpu and not returning even after 30 mins. If I remove queries from force plan and execute same query it is taking less than a second.
This is about azure sql db
1
u/digitalnoise Jul 10 '26
Is this a 2025 feature? We've just rebased to 2022 and are holding (for various reasons) and I haven't seen anything about this, but i could've missed it.
0
u/No_Resolution_9252 Jul 11 '26
I don't think I have ever once seen it fix anything even when query store has a better plan available in it
Admittedly I haven't checked to see if it has applied anything, but have had a number of cases where a bad plan was created then just used the bad plan when a better plan was right there
0
u/drunkadvice Jul 11 '26
I was really excited for it when I saw demos at Ignite in 2016. I haven’t seen it work in practice, and wasn’t able to trigger it in a lab setting.
Part of our problem is that we have a really high recompilation rate due to nested stored procs going rbar.
I’m excited to see you on querystore! It has so much potential. I was afraid it was going to languish!