.alter table partitioning policy

Changes a table partitioning policy. The partitioning policy defines if and how extents (data shards) should be partitioned for a specific table or a materialized view. The command requires DatabaseAdmin permissions.

Syntax

.alter table TableName policy partitioning PolicyObject

Arguments

  • TableName - Specify the name of the table.
  • PolicyObject - Define a policy object, see also partitioning policy.

Example

Set a policy with a hash partition key:

.alter table [table_name] policy partitioning ```
{
  "PartitionKeys": [
    {
      "ColumnName": "my_string_column",
      "Kind": "Hash",
      "Properties": {
        "Function": "XxHash64",
        "MaxPartitionCount": 128,
        "PartitionAssignmentMode": "Uniform"
      }
    }
  ]
}```

Set a policy with a uniform range datetime partition key:

.alter table [table_name] policy partitioning ```
{
  "PartitionKeys": [
    {
      "ColumnName": "my_datetime_column",
      "Kind": "UniformRange",
      "Properties": {
        "Reference": "1970-01-01T00:00:00",
        "RangeSize": "1.00:00:00",
        "OverrideCreationTime": false
      }
    }
  ]
}```

Set a policy with two kinds of partition keys:

.alter table [table_name] policy partitioning ```
{
  "PartitionKeys": [
    {
      "ColumnName": "my_string_column",
      "Kind": "Hash",
      "Properties": {
        "Function": "XxHash64",
        "MaxPartitionCount": 128,
        "PartitionAssignmentMode": "Uniform"
      }
    },
    {
      "ColumnName": "my_datetime_column",
      "Kind": "UniformRange",
      "Properties": {
        "Reference": "1970-01-01T00:00:00",
        "RangeSize": "1.00:00:00",
        "OverrideCreationTime": false
      }
    }
  ]
}```