{"id":14355,"date":"2024-01-01T10:05:41","date_gmt":"2024-01-01T10:05:41","guid":{"rendered":"https:\/\/blog.bachi.net\/?p=14355"},"modified":"2024-01-01T10:37:53","modified_gmt":"2024-01-01T10:37:53","slug":"sql","status":"publish","type":"post","link":"https:\/\/blog.bachi.net\/?p=14355","title":{"rendered":"SQL Execution Order"},"content":{"rendered":"<p><a href=\"https:\/\/www.youtube.com\/watch?v=BHwzDmr6d7s\">Secret To Optimizing SQL Queries &#8211; Understand The SQL Execution Order<\/a><\/p>\n<ul>\n<li>Execution Plan<\/li>\n<li>Search Argument Able (SARGABLE)<\/li>\n<\/ul>\n<ul>\n<li>Index Scan (bigTransactionalHistory)<\/li>\n<li>Stream Aggregare (Aggregate)<\/li>\n<li>Parallelism (Repartition Streams)<\/li>\n<li>Stream Aggregare (Aggregate)<\/li>\n<li>Clustered Index Scan (bigProduct)<\/li>\n<li>Parallelsim (Repartition Streams)<\/li>\n<li>Merge Join (Inner Join)<\/li>\n<li>Parallelism (Gather Streams)<\/li>\n<\/ul>\n<h3>To write sargable queries<\/h3>\n<ul>\n<li>Avoid using functions or calculations on indexed columns in the WHERE clause<\/li>\n<li>Use direct comparisons when possible, instead of wrapping the column in a function<\/li>\n<li>If we need to use a function on a column, consider creating a computed column or a function-based index, if the database system supports it<\/li>\n<\/ul>\n<table>\n<tr>\n<td><a href=\"http:\/\/blog.bachi.net\/wp-content\/uploads\/2024\/01\/sql_execution_order.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.bachi.net\/wp-content\/uploads\/2024\/01\/sql_execution_order.png\" alt=\"\" width=\"919\" height=\"566\" class=\"alignleft size-full wp-image-14359\" srcset=\"https:\/\/blog.bachi.net\/wp-content\/uploads\/2024\/01\/sql_execution_order.png 919w, https:\/\/blog.bachi.net\/wp-content\/uploads\/2024\/01\/sql_execution_order-300x185.png 300w, https:\/\/blog.bachi.net\/wp-content\/uploads\/2024\/01\/sql_execution_order-768x473.png 768w, https:\/\/blog.bachi.net\/wp-content\/uploads\/2024\/01\/sql_execution_order-624x384.png 624w\" sizes=\"auto, (max-width: 919px) 100vw, 919px\" \/><\/a><\/td>\n<\/tr>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>Secret To Optimizing SQL Queries &#8211; Understand The SQL Execution Order Execution Plan Search Argument Able (SARGABLE) Index Scan (bigTransactionalHistory) Stream Aggregare (Aggregate) Parallelism (Repartition Streams) Stream Aggregare (Aggregate) Clustered Index Scan (bigProduct) Parallelsim (Repartition Streams) Merge Join (Inner Join) Parallelism (Gather Streams) To write sargable queries Avoid using functions or calculations on indexed columns [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-14355","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/14355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14355"}],"version-history":[{"count":4,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/14355\/revisions"}],"predecessor-version":[{"id":14360,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/14355\/revisions\/14360"}],"wp:attachment":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}