Query Analyzer - Execution Time

  • Some time ago I recall reading a post about how you could clear QA after executing a query. Basically if you run the same query twice, it runs the second time much faster than the first. I would appreciate being reminded of what to execute so that the query takes the same amount of time.

    Thanks you,

    DB

     

  • The second time it usually runs faster, because the execution plan is cached and reused. To start with the same condition do

    DBCC DROPCLEANBUFFERS

    DBCC FREEPROCCACHE

     

    You might NOT want to do this on a production server.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Thank you Frank. Just what I was looking for!

    Happy New Year!

    Deborah

  • Actually... I have three queries that I am comparing. I have been running them with those two commands in between over an over. I get different times each time (for each select). Not radical - between 22 and 25 secs. Is there anything else I can execute so that I can get the same time each time? I am running on my own sql server - no one else is accessing my machine and I am not running anything else (that is doing anything at the moment anyway) on my machine.

    Thanks - DB

  • Be sure to run "CHECKPOINT" before dropping the cleanbuffers.  Otherwise it may not have the desired effect.

  • Thanks. That seems to help.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply