Small table big performance impact
I recently came across an intersting case with a new stored procedure performance. The SP appeared to be run fast for one parameter value but very slow for another. My initial thought was parameter sniffing. However, a quick WITH RECOMPILE didn’t help. After turn on Live Query Statistics and look at the live data movements, I noticed that the process is doing a index scan on a small table with only 8 rows and then doing nested loop against a large table with out of wack estimates.
Posted by John Liu Tuesday, November 2, 2021