We're seeing a strange pattern in production: the first call to a Dapper-backed endpoint is instant, but the next few within the same minute crawl. SQL Server 2019, same query plan every time according to the actual execution plan.
I enabled SET STATISTICS IO, TIME ON and logical reads jump after the initial execution. Could parameter sniffing be locking the optimizer onto a bad plan from the first parameter set? We don't use OPTION (RECOMPILE). Is there a lightweight way to diagnose or mitigate this without rewriting the whole data layer?
Can you answer this question?
Write Answer0 Answers