Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. About the SQL Execution Plan

About the SQL Execution Plan

Scheduled Pinned Locked Moved Database
questiondatabasetutorial
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mctramp168
    wrote on last edited by
    #1

    1、How to know which SQL statement runs faster than the other SQL statement by contrasting the being displayed execution plan? 2、Could you please tell me the meaning of I/O Cost、CPU Cost、Subtree Cost and Cost? and what is the measuring unit of these costs? and if there is a mathematical expression among the cost,say Cost=I/O Cost+Cpu Cost+subtree cost? 3、Is it possible to compute the accurate time of one SQL statements execution costed by execution plan?

    A M 2 Replies Last reply
    0
    • M mctramp168

      1、How to know which SQL statement runs faster than the other SQL statement by contrasting the being displayed execution plan? 2、Could you please tell me the meaning of I/O Cost、CPU Cost、Subtree Cost and Cost? and what is the measuring unit of these costs? and if there is a mathematical expression among the cost,say Cost=I/O Cost+Cpu Cost+subtree cost? 3、Is it possible to compute the accurate time of one SQL statements execution costed by execution plan?

      A Offline
      A Offline
      Ashfield
      wrote on last edited by
      #2

      The analysis of the execution plan is far too much to reply in a forum, the MSDN documentation gives all the information you need.

      Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

      1 Reply Last reply
      0
      • M mctramp168

        1、How to know which SQL statement runs faster than the other SQL statement by contrasting the being displayed execution plan? 2、Could you please tell me the meaning of I/O Cost、CPU Cost、Subtree Cost and Cost? and what is the measuring unit of these costs? and if there is a mathematical expression among the cost,say Cost=I/O Cost+Cpu Cost+subtree cost? 3、Is it possible to compute the accurate time of one SQL statements execution costed by execution plan?

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        I think you may have the wrong handle on what to use the execution plan for, it is not for timing parts of a query, more for identifying high cost points of your query. Do study the MSDN stuff if you need more detailed information but I look for the highest % nodes and make sure they are for index scans. This is a VERY crude use of the tool but a good first step.

        Never underestimate the power of human stupidity RAH

        D 1 Reply Last reply
        0
        • M Mycroft Holmes

          I think you may have the wrong handle on what to use the execution plan for, it is not for timing parts of a query, more for identifying high cost points of your query. Do study the MSDN stuff if you need more detailed information but I look for the highest % nodes and make sure they are for index scans. This is a VERY crude use of the tool but a good first step.

          Never underestimate the power of human stupidity RAH

          D Offline
          D Offline
          David Mujica
          wrote on last edited by
          #4

          I agree. I typically use the execution plan to make sure I can reduce the number of I/O's; no full table scans ... It has been my experience that if you reduce (or limit) the I/O's your application will respond quickly. Regarding, timing of SQL: Why don't you build your own timer logic and try various SQL statements out? Keep it simple, something like this: Begin timer1 Execute SQL1 End timer1 Begin timer2 Execute SQL2 End timer2 Now check which timer is the smallest. You will have to collect these statistics multiple times to ensure that you are not getting skewed results because the data happens to be in cache.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups