I am peformance-testing queries and alternative schemas in an SQL Compact database. I can very easily observe the repeated execution performance of particular queries; however, I also need a way to accurately measure the first-time execution performance. To do so, I think I should clear the query cache from the database.
This question has been asked multiple times before for standard SQL Server:
- How can I clear the SQL Server query cache?
Answer:
DBCC DROPCLEANBUFFERS;
- How to let SQL Server know not to use Cache in Queries? Answer:
DBCC FREEPROCCACHE;
Or there's always the WITH RECOMPILE
option.
However, none of these options appear to have support in the SQL CE world.
I am accessing the database via a C# application, using the SqlCeCommand
class, so I am looking for either a code hack or an SQL command to clear the execution plan cache from the database between calls.