Clear schema cache for cross-cluster queries

When running a cross-cluster query, the cluster that performs the initial query interpretation must have the schema of the entities referenced on the remote clusters. Sending the command can be an expensive network operation and therefore the remote schema entities are cached.

Any changes to the schema of the remote entity may result in unwanted effects. For example, new columns aren't recognized or deleted columns may cause a 'Partial Query Error' instead of a semantic error. For more information, see Cross-cluster queries and schema changes.

You can use the following command when you need to refresh the schema without waiting for the expiry time of the cache.

Permissions

You must have at least Database User, Database Viewer, or Database Monitor permissions to run this command. For more information, see role-based access control.

Syntax

.clear cache remote-schema cluster('ClusterName').database('DatabaseName')

Learn more about syntax conventions.

Parameters

Name Type Required Description
ClusterName string ✔️ The name of the cluster containing the database for which to clear the cache.
DatabaseName string ✔️ The name of the database for which to clear the cache.

Returns

The command returns a table with the following columns:

Column Type Description
NodeId string Identifier of the cluster node
Status string Succeeded/Failed

Example

.clear cache remote-schema cluster("cluster1").database("database1")

Returns

NodeId Status
0 Cache cleared for database database1