Azure Storage Tables Concepts
This article provides an overview of the concepts associated with Azure Storage Tables. Azure Table storage is a NoSQL key-attribute store that allows you to store large amounts of structured, non-relational data. The main components of Table storage are:
- Accounts: An Azure Storage account provides a unique namespace in Azure for your data.
- Tables: Tables are collections of entities. They do not enforce a schema, so different entities within the same table can have different sets of properties.
- Entities: Entities are the most basic unit of data in Table storage. An entity is a set of properties, similar to a row in a database.
- Properties: Properties are name-value pairs within an entity. Each property consists of a name (string) and a value.
Key Concepts
Entities and Properties
An entity is composed of properties. Each entity can have up to 252 properties. In addition to these 252 properties, an entity must have the following three system properties:
PartitionKey: A string that defines the scope of the entity. Entities with the samePartitionKeyare co-located within the same partition.RowKey: A string that uniquely identifies an entity within a partition.Timestamp: A DateTime value that is automatically maintained by Azure Storage to indicate the last modification time of the entity.
The combination of PartitionKey and RowKey serves as the unique identifier for an entity. Properties can be of various data types, including String, Int32, Int64, Boolean, Double, DateTime, GUID, Binary, and EdmComplexType.
Partitions and Table Design
Entities are grouped into partitions based on their PartitionKey. All entities within a partition share the same PartitionKey value. Azure Table storage uses partitions to manage data distribution and scalability. To maximize performance and scalability, you should design your tables such that entities with frequently accessed data together are placed in the same partition.
PartitionKey is crucial for performance. A well-chosen PartitionKey can distribute load evenly across partitions, while a poorly chosen one can lead to hot partitions and performance bottlenecks.
Queries and Data Access
You can query entities within a table by specifying filter conditions on properties. Queries can be targeted to a specific partition or across all partitions in a table. Azure Table storage supports OData query protocols for accessing data.
For example, a simple query to retrieve entities with a specific PartitionKey and RowKey would look like:
GET /MyTable(PartitionKey='partition1',RowKey='row1')?query HTTP/1.1
Scalability and Performance
Azure Table storage is designed to be highly scalable and can store vast amounts of data. Performance is optimized by the efficient distribution of data across partitions. Key considerations for performance include:
- Choosing appropriate
PartitionKeyandRowKeyvalues. - Minimizing the number of requests by retrieving or updating multiple entities in a single batch.
- Using the appropriate query patterns.
PartitionKey are guaranteed to be stored on the same storage node, which enables efficient querying and batch operations within a partition.
Data Types
Azure Table storage supports a rich set of data types for entity properties. These include:
| Type Name | Description |
|---|---|
Edm.String |
String values. |
Edm.Int32 |
32-bit signed integer. |
Edm.Int64 |
64-bit signed integer. |
Edm.Boolean |
Boolean value (true/false). |
Edm.Double |
Double-precision floating-point number. |
Edm.DateTime |
Date and time value. |
Edm.Guid |
Globally unique identifier. |
Edm.Binary |
Binary data (byte array). |
Edm.Decimal |
Decimal number. |
Schema-less Nature
A key characteristic of Azure Table storage is its schema-less nature. Unlike relational databases, tables in Azure Table storage do not enforce a predefined schema. This means that different entities within the same table can have different sets of properties. This flexibility is ideal for handling evolving data requirements and semi-structured data.
Back to top