.alter database policy caching command

Applies to: ✅ Microsoft FabricAzure Data Explorer

Changes the database cache policy. To speed up queries, data is cached on processing nodes, SSD, or even in RAM. The cache policy allows your database to describe the data artifacts that it uses, so that more important data can take priority.

Permissions

You must have at least Database Admin permissions to run this command.

Syntax

.alter database DatabaseName policy caching PolicyParameter

Learn more about syntax conventions.

Parameters

Name Type Required Description
DatabaseName string ✔️ The name of the database for which to alter the caching policy.
PolicyParameter string ✔️ One or more policy parameters. For parameters, see cache policy.

Returns

Returns a JSON representation of the policy.

Example

The following example sets the caching policy to include the last 30 days.

.alter database MyDatabase policy caching hot = 30d

Output

PolicyName EntityName Policy ChildEntities EntityType
CachingPolicy database1 {"DataHotSpan": {"Value": "30.00:00:00"},"IndexHotSpan": { "Value": "30.00:00:00" }}

Define hot-cache windows

This command sets the caching policy to include the last 30 days and additional data from January and April 2021.

.alter database MyDatabase policy caching 
        hot = 30d,
        hot_window = datetime(2021-01-01) .. datetime(2021-02-01),
        hot_window = datetime(2021-04-01) .. datetime(2021-05-01)

Output

PolicyName EntityName Policy ChildEntities EntityType
CachingPolicy {"DataHotSpan": { "Value": "30.00:00:00" }, "IndexHotSpan": { "Value": "30.00:00:00" },"HotWindows": [{ "MinValue": "2021-01-01T00:00:00Z", "MaxValue": "2021-02-01T00:00:00Z" }, { "MinValue": "2021-04-01T00:00:00Z", "MaxValue": "2021-05-01T00:00:00Z" }]}