Analysis Services XMLA to clear query cache

To get a realistic measurement of how your query tuning improves query response time you should start from a common point.  To help with this you should clear your query cache before running a queries after making improvements (Unless you are cache warming of course !).
Here is some XMLA script to clear the cache for a specified database.
<Batch xmlns="https://schemas.microsoft.com/analysisservices/2003/engine">
   <ClearCache>
      <Object>
         <DatabaseID> database id </DatabaseID>
         <CubeID> cube id </CubeID>
      </Object>
   </ClearCache>
</Batch>

Replace database id and cube id with the details for your cube.  Notice these are ids, not names.  Look in the Analysis Services properties windows to find the ids.

Leave a Reply

Your email address will not be published. Required fields are marked *