Other

PartitionKey and RowKey in Azure Table Storage explained

Maarten Balliauw Maarten Balliauw
Other

A refreshed guide to Azure Table Storage partitioning: how PartitionKey and RowKey form the primary key, how your choice affects query cost and scale, and how to model them with Azure.Data.Tables in C#.

Key points

  • Point queries on PartitionKey plus RowKey are the fastest read path in Azure Table Storage and Cosmos DB for Table.
  • Keys are limited to 1024 characters and cannot contain /, \, #, ? or control characters.
  • A single partition targets roughly 2000 entities per second for 1 KB entities; beyond that the service returns 503 Server Busy.
  • Filtering on RowKey alone still triggers a table scan because the partition cannot be located.
  • Results are ordered by PartitionKey then RowKey as strings, so numeric keys need zero padding.
  • Entities cap at 1 MB in Table Storage and 2 MB in Cosmos DB for Table.

Real-world use

  • A multi-tenant order system where orders are partitioned by customer id so a customer's order history loads from a single partition.
  • A telemetry writer that spreads devices across many partitions to stay under per-partition throughput and avoid 503 Server Busy responses.
  • An audit log that pads a numeric sequence in RowKey so range queries return entries in chronological order.
  • A sales app that partitions customers by region and looks up users by point query on region plus customer id.

This summary was generated by the agent from the original post on Maarten Balliauw. The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message