SQL query plan

BeliasBelias Member Posts: 2,998
edited 2009-11-13 in SQL General
Hi everyone, can someone tell me how to decypher this query plan, or better where can i find a guide which explains all the operators? (i found on msdn something which explains the words, but what about the numbers like [2,1],[3,2] etc? thanks in advance
Sort[2,1];Filter[3,2];Nested Loops[4,3];Index Seek($3)[5,4];Clustered Index Seek(Company$Cylinder Rental Calculation$0)[7,4]
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog

Answers

  • strykstryk Member Posts: 645
    Sort[2,1];Filter[3,2];Nested Loops[4,3];Index Seek($3)[5,4];Clustered Index Seek(Company$Cylinder Rental Calculation$0)[7,4]
    Actually you have to read the QEP from right to left:

    1. SQL Server perfroms a "Seek" on non-clustered Index "$3" (this is usually the best index matching to the WHERE clause)
    2. As NAV always executes a SELECT * (= all fields) the SQL Server has to perfrom a "Key Lookup", e.g. a "Seek" on the Clustered Index "Company$Cylinder Rental Calculation$0" to retrieve all other fields from the table
    3. The results are combined and filtered
    4. The result is sorted to match the ORDER BY clause

    That should be it ... more or less ...
    Jörg A. Stryk (MVP - Dynamics NAV)
    NAV/SQL Performance Optimization & Troubleshooting
    STRYK System Improvement
    The Blog - The Book - The Tool
  • BeliasBelias Member Posts: 2,998
    Thanks! and what about the numbers within square brackets? e.g.: [3,2]
    Is there a documentation for all this?(i found something on msdn, but the square brackets numbers are not explained)
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • strykstryk Member Posts: 645
    Sorry, I don't know what the [x,y] mean ... :-k

    Here some info about QEP: http://www.sql-server-performance.com/tips/query_execution_plan_analysis_p1.aspx
    Jörg A. Stryk (MVP - Dynamics NAV)
    NAV/SQL Performance Optimization & Troubleshooting
    STRYK System Improvement
    The Blog - The Book - The Tool
  • BeliasBelias Member Posts: 2,998
    thanks, anyway
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
Sign In or Register to comment.