« Performance of range queries on a Windows Azure Table Vs a Normal Database Table | Main | Is cloud computing same as putting things Online? »

Changing partition key in Windows Azure Table Storage

You might have faced a situation where you have defined your partition key logic initially and due to some reasons you need to change your partition logic to something else.


Read on to know how you are going to handle such situations.

 

I have an application for which the Partition Key has been defined as the names of all the months.

 

PartitionKey = "January";

PartitionKey = "February";

---

PartitionKey = "December";

 

Now, I want to change the partition key logic. I want to change the partition to something like - "January2011", "January2012" etc.

 

Changing partition key is not possible in Windows Azure.

 

The only possible way is to delete and add the existing entity with a new partition logic.

 

Table.DeleteObject(entity);

Table.SaveChanges();

entity.PartitionKey = new PartitionKey();

Table.AddObject("entity", entity);

Table.SaveChanges();

 

One possible reason for not being able to change the partition key is that all the entities with same partition key are clustered together and now if we change the partition logic then all the clusters must be reconfigured.  

 

Reference:  http://social.msdn.microsoft.com/Forums/en/windowsazure/thread/8f609080-eac1-4e4c-99c3-4bb9e6d76c9d   

 

 

 

TrackBack

TrackBack URL for this entry:
http://www.infosysblogs.com/apps/mt-tb.cgi/4488

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Please key in the two words you see in the box to validate your identity as an authentic user and reduce spam.

Subscribe to this blog's feed

Follow us on

Blogger Profiles

Infosys on Twitter