Windows Azure–Table Storage

Windows Azure provides three storage services – Table, Blobs and Queues. Here I explained about the Table Storage. Before getting into the coding stuff let me put some points about the Azure table storage.

Do not get misunderstand the Azure tables with a RDBMS table. In RDBMS table is an entity, but Azure table is a storage service.

We have rows and columns structure in Azure table. A row is called an Entity in Azure table. Columns are called Properties.

There 3 system properties attached to each Azure table, they are Partition Key, Row Key and Timestamp. Ex If you are creating a Azure table with Name, Address properties then your table would have total of 5 properties including the 3 system properties.

What are the System Properties ?

Partition Key – We know Windows Azure is a cloud OS hosted in MS datacenters. Where the applications and services we deploy are distributed among several servers. So when storing data in Windows Azure, partition key allows us to distribute the data among different partitions. (physically these partitions no need to be in different servers, they can be in one particular server as well; but Windows Azure maintains a method of grouping the data)

So If your table has very few numbers of entities, then probably you don’t need to create more partition keys. One is enough.

Still there are plenty of arguments and posts on selecting a proper partition key. Select the partition key in a way that you can balance the load of your table storage.

Partition keys are string values.

Row Key – Row keys are unique within a particular partition. We know partition keys form partitions. Within a partition a row key cannot be duplicated. So the partition key and the row key together forms a the unique identifier for a entity, similar to primary key known as Data Service Key.

Row key is also string value. Normally in the MS sites you can see this kind of row key implementation

RowKey = string.Format("{0:10}_{1}", DateTime.MaxValue.Ticks – DateTime.Now.Ticks, Guid.NewGuid());

This picture will explain you the concept of Partition Key and Row Key



Timestamp – This is fully maintained by the system. Every entity has a version maintained by the system. Timestamp is not a property for application programming uses. It is transparent to the users.

According MS Documentation – Timestamp is a read-only system maintained property which should be treated as an opaque property.

Azure Table Storage More…

An application must use a valid account to access Windows Azure Storage. You can create a new account via the Windows Azure portal web interface. The user will receive a 256-bit secret key once the account is created. This secret key is then used to authenticate user requests to the storage system.

Specifically, a HMAC SHA256 signature for the request is created using this secret key. The signature is passed with each request to authenticate the user requests. The account name is part of the host name in the URL. The hostname for accessing tables is <accountName>

An entity can have at most 255 properties including the mandatory system properties, so we can have our own 252 properties (columns).

Partition Key and Row Key are of string type, and each key is limited to 1KB in size.

Combined size of all data in an entity cannot exceed 1MB. This size includes the size of the property names as well as the size of the property values or their types, which includes the two mandatory key properties (Partition Key and Row Key).

Supported property types are: Binary, Bool, DateTime, Double, GUID, Int, Int64, String.