SQL Execution Order

Secret To Optimizing SQL Queries – 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 in the WHERE clause
  • Use direct comparisons when possible, instead of wrapping the column in a function
  • 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

Leave a Reply

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