Grant Fritchey - Wednesday, January 18, 2017 10:47 AM
I'm fighting a problem right now where some lovely ORM generated code adds something like 30 different criteria to the WHERE clause. Because of its complexity and the constantly changing data it's provided, it ALWAYS recompiles and it takes 2 to 15 SECONDS to do so. It get's called several thousand times every hour. We're replacing it with a stored procedure. The real key is that one of the items that it passes to the WHERE clause is the PK for the table. One of the reasons why it takes so long to recompile is because the idiotic stats maintenance code that my predecessors used built stats on every single column of every single table and this particular table has 139 columns. Yeah... working on that lovely issue, as well.
--Jeff Moden
Change is inevitable... Change for the better is not.