Clear Analysis Services (SSAS) database cache

Example of command to clear cache for database:

<ClearCache xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<Object>
<DatabaseID>Adventure Works DW</DatabaseID>
</Object>
</ClearCache>

Example of command to clear cache for cube:

<ClearCache xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<Object>
<DatabaseID>Adventure Works DW</DatabaseID>
<CubeID>Adventure Works DW</CubeID>
</Object>
</ClearCache>

Example of command to clear cache for measure group:

<ClearCache xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<Object>
<DatabaseID>Adventure Works DW</DatabaseID>
<CubeID>Adventure Works DW</CubeID>
<MeasureGroupID>Fact Internet Sales 1</MeasureGroupID>
</Object>
</ClearCache>

You cannot clear cache for partition. You will get following error message:

Errors in the metadata manager. The object with ID of 'Internet_Sales_2001', Name of 'Internet_Sales_2001' is of type 'partition' which does not support the requested operation.

 

If you are testing one MDX script performance, you should first clear cache and then submit query. You can easily submit clear cache XMLA statement and MDX query in the same batch:

<ClearCache xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<Object>
<DatabaseID>Adventure Works DW</DatabaseID>
</Object>
</ClearCache>
go

SELECT [Measures].[Internet Sales] ON 0
FROM [Adventure Works]
go

 

你可能感兴趣的:(database)