Essentially this procedure (particularly the final Select statement) was showing up in plan cache metrics as a top reader, million+ page reads per run. User traced issue to the Optimizer and the table variables do not maintain statistics and therefore often are estimated to 1 row returned, resulting in a bad query plan that does a looped table scan of Sysjobhistory.
As a workaround user added "option (recompile)" to the statement in question. However upgrading Spotlight will overwrite this change.
You need to be signed in and under a current maintenance contract to view premium knowledge articles.
© 2024 Quest Software Inc. ALL RIGHTS RESERVED. Feedback Terms of Use Privacy Cookie Preference Center