缓存策略命令cache policy command
本文介绍用于创建和更改缓存策略的命令This article describes commands used for creation and altering cache policy
显示缓存策略Displaying the cache policy
可以对数据库、表或具体化视图设置此策略,并可以使用以下命令之一来显示此策略:The policy can be set on a database, a table or a materialized view, and is displayed by using one of the following commands:
.show
database
DatabaseNamepolicy
caching
.show
database
DatabaseNamepolicy
caching
.show
table
TableNamepolicy
caching
.show
table
TableNamepolicy
caching
.show
materialized-view
MaterializedViewNamepolicy
caching
.show
materialized-view
MaterializedViewNamepolicy
caching
更改缓存策略Altering the cache policy
.alter <entity_type> <database_or_table_or_materialized-view_name> policy caching hot = <timespan>
更改多个表的缓存策略(在相同数据库上下文中):Altering cache policy for multiple tables (in the same database context):
.alter tables (table_name [, ...]) policy caching hot = <timespan>
缓存策略:Cache policy:
{
"DataHotSpan": {
"Value": "3.00:00:00"
},
"IndexHotSpan": {
"Value": "3.00:00:00"
}
}
entity_type
:表、具体化视图、数据库或群集entity_type
: table, materialized view, database, or clusterdatabase_or_table_or_materialized-view
:如果实体为表或数据库,则应在命令中指定其名称,如下所示:database_or_table_or_materialized-view
: if entity is table or database, its name should be specified in the command as follows -database_name
或database_name
ordatabase_name.table_name
或database_name.table_name
ortable_name
(在特定数据库的上下文中运行时)table_name
(when running in the specific database's context)
删除缓存策略Deleting the cache policy
.delete <entity_type> <database_or_table_name> policy caching
示例Examples
显示数据库 MyDatabase
中表 MyTable
的缓存策略:Show cache policy for table MyTable
in database MyDatabase
:
.show table MyDatabase.MyTable policy caching
将表 MyTable
的缓存策略(在数据库上下文中)设置为 3 天:Setting cache policy of table MyTable
(in database context) to 3 days:
.alter table MyTable policy caching hot = 3d
.alter materialized-view MyMaterializedView policy caching hot = 3d
将多个表的策略(在数据库上下文中)设置为 3 天:Setting policy for multiple tables (in database context), to 3 days:
.alter tables (MyTable1, MyTable2, MyTable3) policy caching hot = 3d
删除针对表设置的策略:Deleting a policy set on a table:
.delete table MyTable policy caching
删除针对具体化视图设置的策略:Deleting a policy set on a materialized view:
.delete materialized-view MyMaterializedView policy caching
删除针对数据库设置的策略:Deleting a policy set on a database:
.delete database MyDatabase policy caching