Been thinking a lot about something that was mentioned in a few of my most recent posts… Especially when I get comments like “that’s another item to add to our checklist” or “that’s a good trick to add to our arsenal” and well, I thought in this blog entry I’d ask for your tricks that fall under the umbrella of designing for performance.
For example – do you change collations? I had a recommendation here.
For example – do you have a view that you want ordered? I had a recommendation (with caution) here. But – Adam Mechanic came back and said that he’s used that trick to improve performance… and, I’m sure that’s the case as well!
For example – do you have stored procedure parameters that are giving you grief? I had a series of recommendations in my Optimizing Procedural Code category here.
In fact, sometimes the best form of “hint” to SQL Server is NOT an optimizer hint but instead a more subtle change to the join (derived tables for example) or the infamous subquery -> join rewrite or the join -> subquery rewrite. I’m always asked “which is better – a subquery or a join” and I always answer YES. ;-) OR taking a complex process and breaking it down into temp tables (I’d try to create views instead of temp tables first and see if the optimizer figures it out but there are cases when sometimes they just don’t). Remember, it’s not the optimizer’s job to find the absolutely BEST plan; it’s their job to find a good plan fast. And – they typically do. Really, no general “tricks” work ALL of the time and often they don’t help at all but there are LOTS of things that I’m sure you’ve done and you really want to tell someone about it. How about here? I’m going to try to compile these tips/tricks into a best of…