合并策略命令Merge policy command

显示策略show policy

.show table [table_name] policy merge

.show table * policy merge

.show database [database_name] policy merge

.show database * policy merge

显示数据库或表的当前合并策略。Displays the current merge policy for the database or table. 如果给定名称为“*”,则显示给定实体类型(数据库或表)的所有策略。Shows all policies of the given entity type (database or table) if the given name is '*'.

输出Output

策略名称Policy Name 实体名称Entity Name 策略Policy 子实体Child entities 实体类型Entity Type
ExtentsMergePolicyExtentsMergePolicy 数据库/表名称Database / Table name 一个表示策略的 JSON 格式字符串a JSON-formatted string that represents the policy 表列表(对于数据库)A list of tables (for a database) 数据库 | 表Database | Table

更改策略alter policy

示例Examples

1.在表级别显式设置策略的所有属性:1. Setting all properties of the policy explicitly, at table level:

.alter table [table_name] policy merge 
@'{'
    '"ExtentSizeTargetInMb": 1024,'
    '"OriginalSizeInMbUpperBoundForRebuild": 2048,'
    '"OriginalSizeInMbUpperBoundForMerge": 4096,'
    '"RowCountUpperBoundForRebuild": 750000,'
    '"RowCountUpperBoundForMerge": 0,'
    '"MaxExtentsToMerge": 100,'
    '"LoopPeriod": "01:00:00",'
    '"MaxRangeInHours": 8,'
    '"AllowRebuild": true,'
    '"AllowMerge": true '
'}'

2.在数据库级别显式设置策略的所有属性:2. Setting all properties of the policy explicitly, at database level:

.alter database [database_name] policy merge 
@'{'
    '"ExtentSizeTargetInMb": 1024,'
    '"OriginalSizeInMbUpperBoundForRebuild": 2048,'
    '"OriginalSizeInMbUpperBoundForMerge": 4096,'
    '"RowCountUpperBoundForRebuild": 750000,'
    '"RowCountUpperBoundForMerge": 0,'
    '"MaxExtentsToMerge": 100,'
    '"LoopPeriod": "01:00:00",'
    '"MaxRangeInHours": 8,'
    '"AllowRebuild": true,'
    '"AllowMerge": true'
'}'

3.在数据库级别设置默认合并策略:3. Setting the default merge policy at database level:

.alter database [database_name] policy merge '{}'

4.在数据库级别更改策略的单个属性,按原样保留所有其他属性:4. Altering a single property of the policy at database level, keeping all other properties as-is:

.alter-merge database [database_name] policy merge
@'{'
    '"ExtentSizeTargetInMb": 1024'
'}'

5.在表级别更改策略的单个属性,按原样保留所有其他属性:5. Altering a single property of the policy at table level, keeping all other properties as-is:

.alter-merge table [table_name] policy merge
@'{'
    '"RowCountUpperBoundForRebuild": 750000'
'}'

以上所有示例都返回实体(指定为限定名称的数据库或表)的已更新盘区合并策略作为其输出。All of the above returns the updated extents merge policy for the entity (database or table specified as a qualified name) as their output.

对策略的更改可能需要长达 1 小时的时间才能生效。Changes to the policy could take up to 1 hour to take effect.

删除合并策略delete policy of merge

.delete table [table_name] policy merge

.delete database [database_name] policy merge

此命令删除给定实体的当前合并策略。The command deletes the current merge policy for the given entity.