{"id":29,"date":"2013-08-24T16:46:35","date_gmt":"2013-08-24T16:46:35","guid":{"rendered":"http:\/\/www.sqlkitten.com\/?p=29"},"modified":"2013-08-24T16:46:35","modified_gmt":"2013-08-24T16:46:35","slug":"sql-saturday-223-unraveling-tangled-code-with-jen-mccown","status":"publish","type":"post","link":"http:\/\/www.sqlkitten.com\/?p=29","title":{"rendered":"SQL Saturday #223 &#8211; Unraveling Tangled Code with Jen McCown"},"content":{"rendered":"<p>Organize<\/p>\n<ul>\n<li>Format &#8211; when you change the formatting and then alter your procedure this will mess with your plan cache; SQL Refactor by Apex; SQLPrettifier<\/li>\n<li>Comment &#8211;\u00a0\u00a0Pseudocode; this should more of a description of what you are doing rather than the code itself<\/li>\n<\/ul>\n<p>Breakdown<\/p>\n<ul>\n<li>Structure plan of attack &#8211; sketch your query<\/li>\n<li>Main query -&gt; subquery -&gt;subquery<\/li>\n<\/ul>\n<p>Streamline<\/p>\n<ul>\n<li>Obvious issues &#8211; extra rows, columns, unnecessary work, non-SARGable where clauses (cannot be indexed)<\/li>\n<li>Streamline joins<\/li>\n<li>Similar subqueries<\/li>\n<li>Other &#8211; functions, etc.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Organize Format &#8211; when you change the formatting and then alter your procedure this will mess with your plan cache; SQL Refactor by Apex; SQLPrettifier Comment &#8211;\u00a0\u00a0Pseudocode; this should more of a description of what you are doing rather than &hellip; <a href=\"http:\/\/www.sqlkitten.com\/?p=29\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,3],"tags":[],"_links":{"self":[{"href":"http:\/\/www.sqlkitten.com\/index.php?rest_route=\/wp\/v2\/posts\/29"}],"collection":[{"href":"http:\/\/www.sqlkitten.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.sqlkitten.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.sqlkitten.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.sqlkitten.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=29"}],"version-history":[{"count":2,"href":"http:\/\/www.sqlkitten.com\/index.php?rest_route=\/wp\/v2\/posts\/29\/revisions"}],"predecessor-version":[{"id":31,"href":"http:\/\/www.sqlkitten.com\/index.php?rest_route=\/wp\/v2\/posts\/29\/revisions\/31"}],"wp:attachment":[{"href":"http:\/\/www.sqlkitten.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.sqlkitten.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.sqlkitten.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}