I am using MS SQL Server 2012. I am trying to see the optimization in the server so I can't just clear everything.
This link didn't work for me. (or this example )
Any suggestions how I can select the query and clear the cache afterwards?
(or prevent it from caching would be better)
EDIT:
Most desired outcome is testing the select query like it's running for the very first time.
You can query sys.dm_exec_connections
to get a handle to last executed query for a given connection, and then evict that plan with DBCC FREEPROCCACHE
. Make sure you do this on another connection.
Alternatively, use WITH RECOMPILE
or OPTION(RECOMPILE)
to not cache the plan at all:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.