Ref:
http://www.cnblogs.com/CareySon/archive/2013/05/04/PlanCacheInSQLServerPart2.html
https://msdn.microsoft.com/zh-cn/library/ms181055(v=SQL.105).aspx
recompile后在sys.dm_exec_query_plan(s1.plan_handle)中查不到QueryPlan,这样就没有cache,so,下次执行时重新生成queryPlan。
select * from ds_stg.tr_sec option(recompile) select top 100 Query_plan, Creation_time , Last_execution_time , Execution_count , Last_rows,text,* from sys.dm_exec_query_stats s1 cross apply sys.dm_exec_sql_text(sql_handle) as s2 CROSS APPLY sys.dm_exec_query_plan(s1.plan_handle) qp where text like 'select * from ds_stg.tr_sec%' option(recompile