Azure Storage Tables

Microsoft Documentation

Understanding the Azure Storage Table Data Model

Azure Table storage is a NoSQL key-attribute store that allows you to store large amounts of structured, non-relational data. It's designed for scenarios where you need flexible data schemas and high scalability. This document explains the core concepts of the Azure Table storage data model.

Core Concepts

The fundamental entities in Azure Table storage are:

Tables

A table is a container for entities. All entities within a table share a similar structure (schema), but this structure can vary from entity to entity. You can have multiple tables within a storage account.

Entities

An entity is the basic unit of data in Azure Table storage. Each entity is a collection of properties. Every entity MUST have the following two properties:

Together, PartitionKey and RowKey form the entity's unique identifier, known as the entity key.

Properties

In addition to PartitionKey and RowKey, an entity can contain up to 252 additional properties. Properties are name-value pairs.

All properties are stored as Strings or DateTimes internally, and are converted to the appropriate .NET type when retrieved. Azure Table storage does not enforce a schema for these 252 properties. An entity can have a completely different set of properties from another entity in the same table.

Note: Properties that are null are not stored.

Entity Keys (PartitionKey and RowKey)

The PartitionKey and RowKey are critical for efficient data access and scalability.

Example Entity Structure

Entity 1

  • PartitionKey: "User"
  • RowKey: "user123"
  • Name: "Alice Smith"
  • Email: "alice.smith@example.com"
  • Age: 30
  • IsActive: true

Entity 2

  • PartitionKey: "User"
  • RowKey: "user456"
  • Name: "Bob Johnson"
  • Email: "bob.j@example.com"
  • RegistrationDate: 2023-10-26T10:00:00Z

Entity 3

  • PartitionKey: "Product"
  • RowKey: "prodA789"
  • ProductName: "Gadget Pro"
  • Price: 99.99
  • StockCount: 150

Operations on Entities

Azure Table storage supports the following operations on entities:

Batch Operations

You can perform batch operations to insert, update, or delete multiple entities in a single request. However, batch operations are limited to entities within the same PartitionKey.

Data Types and Limits

Azure Table storage offers a flexible data model. However, be aware of the following limits:

Best Practices: Design your PartitionKey strategically to balance query performance and scalability. Consider partitioning by common query filters like date, user ID, or type.