Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2005
    Posts
    12

    Unanswered: Flush query cache

    Is there a clean way to flush the query cache so I can simulate the first execution of an SQL statement any time I want to?

  2. #2
    Join Date
    Aug 2005
    Posts
    12
    NVM, I should have searched before posting. I found DBCC DROPCLEANBUFFERS, which does the trick.

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Quote Originally Posted by dummyforsql
    Is there a clean way to flush the query cache so I can simulate the first execution of an SQL statement any time I want to?
    That's very good thinking.....I'd say 90% (or more) new db developers don't think about that...or are perplexed why it took so long the first time, but now runs very fast when I re-run the code....
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    You can also use sp_recompile to force aging out of the old plan against any of the participating tables in the query.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •