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.
In this article
Applies to: ✅ Azure Data Explorer
Use this command to change a 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.
You must have at least Table Admin permissions to run this command.
.alter
table
TableName policy
roworder
(
SortKey (asc
| desc
) [,
...])
Learn more about syntax conventions.
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.
.alter table events policy roworder (TenantId asc, Timestamp desc)
.alter tables (events1, events2, events3) policy roworder (TenantId asc, Timestamp desc)
The following example sets the row order policy on the TenantId
column (ascending) as a primary key, and on the Timestamp
column (ascending) as the secondary key. The policy is then queried.
.alter table events policy roworder (TenantId asc, Timestamp desc)
.alter tables (events1, events2, events3) policy roworder (TenantId asc, Timestamp desc)
.show table events policy roworder
TableName | RowOrderPolicy |
---|---|
events | (TenantId asc, Timestamp desc) |