SQL Saturday #223 – Unraveling Tangled Code with Jen McCown

Organize

  • 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

Breakdown

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

Streamline

  • 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 *