Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer
Change's the table's partitioning policy. The partitioning policy defines if and how extents (data shards) should be partitioned for a specific table or a materialized view.
Permissions
You must have at least Database Admin permissions to run this command.
Syntax
.alter
table
TableName policy
partitioning
PolicyObject
Learn more about syntax conventions.
Parameters
Name | Type | Required | Description |
---|---|---|---|
TableName | string |
✔️ | The name of the table to alter. |
PolicyObject | string |
✔️ | A serialized JSON policy object. See partitioning policy. |
Examples
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
}
}
]
}```