How to freeze the TSQL session while we executing the query again again?

  • I'm using one query window and trying to tune the Query, if i runs twice or thrice it's taking Old execution plan and Cash,So before executing query what are the DBCC commands?, should i follow and clear on current sessions?

  • Hi Saravanan,

    Use DBCC DROPCLEANBUFFERS to test queries with a cold buffer cache without shutting down and restarting the server. DBCC DROPCLEANBUFFERS serves to empty the data cache.

    Regards,

    Karthik.

    Regards,
    Karthik.
    SQL Developer.

  • But be sure you dont run that on a production server, unless you can live with the performance bottleneck while SQL rebuilds the cache.

  • THanks for answer, So what will happen or difference between with DBCC FREESESSIONCACHE ,

  • DBCC DROPCLEANBUFFERS - Removes all clean buffers from the buffer pool.

    DBCC FREESESSIONCACHE - Flushes the distributed query connection cache used by distributed queries against an instance of Microsoft SQL Server.

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

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