.alter-merge table policy roworder command
Applies to: ✅ Azure Data Explorer
Changes the table's row order policy. The row order policy is an optional table policy that defines the row order in an extent (data shard). This policy can improve performance for queries that relate to a small set of values that can be ordered.
Permissions
You must have at least Table Admin permissions to run this command.
Syntax
.alter-merge
table
TableName policy
roworder
(
SortKey (asc
| desc
) [,
...])
Learn more about syntax conventions.
Parameters
Name | Type | Required | Description |
---|---|---|---|
TableName | string |
✔️ | The name of the table. |
SortKey | string |
✔️ | The column by which to sort the data in the extent. |
Tip
We recommend using a maximum of two sort keys. For more information, see Performance considerations.
Examples
Set the row order policy for one table:
.alter-merge table events policy roworder (TenantId asc, Timestamp desc)
Set the row order policy for several tables:
.alter-merge tables (events1, events2, events3) policy roworder (TenantId asc, Timestamp desc)