SQL Saturday #223 – Unraveling Tangled Code with Jen McCown


  • Format – when you change the formatting and then alter your procedure this will mess with your plan cache; SQL Refactor by Apex; SQLPrettifier
  • Comment –¬†¬†Pseudocode; this should more of a description of what you are doing rather than the code itself


  • Structure plan of attack – sketch your query
  • Main query -> subquery ->subquery


  • Obvious issues – extra rows, columns, unnecessary work, non-SARGable where clauses (cannot be indexed)
  • Streamline joins
  • Similar subqueries
  • Other – functions, etc.

Leave a Reply

Your email address will not be published. Required fields are marked *