Erik Darling might have found the Bermuda Triangle:
While helping a client out with weird performance issues, we isolated part of the code that was producing a whole bunch of bad plans.
At the intersection of bad ideas, there was a cursor looping over a table gathering some data points with a local variable in the where clause.
Click through to understand why this isn’t a great idea.