Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

I execute the follwing query.

SQL
SELECT deqs.last_execution_time AS [Time], dest.TEXT AS [Query],
	dess.host_name as 'Host Name'
	FROM sys.dm_exec_query_stats AS deqs
	CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest 
	cross apply sys.dm_exec_sessions dess
	where deqs.last_execution_time BETWEEN DATEADD(dy, -3, GETDATE()) AND
	GETDATE() and 
	dest.text like 's%' and dess.session_id = @@spid
	ORDER BY deqs.last_execution_time DESC


it will execute successfully. But when server restart the executed queries are clear.
how can i cache that queries.

can you please help me.

thanks in advance.
Posted
Updated 29-Sep-11 19:45pm
v2
Comments
Mehdi Gholam 30-Sep-11 1:47am    
Please clarify what you mean by caching the query (where on the db or in the app layer)?

1 solution

I have a feeling that these articles may answer your question

sys.dm_exec_query_stats[^]

This article shows that execution plans are memory based tables / views

Execution plan caching[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900