azure table : Duplicate partition key results in (409) conflict

user20358 picture user20358 · Feb 20, 2014 · Viewed 10k times · Source

I am trying to insert multiple rows into the Azure table service. As far as this article goes, I have understood the partition key to be able to store duplicates. However, while following this article, when I try to insert a duplicate partition key I get an error:

The remote server returned an error: (409) Conflict.

What could be wrong in my code? I am following it as per the second article; Or is my understanding incorrect? Also, the first article says that the row key is supposed to act as primary key. The second article says I can hardcode it for the example. This has me confused as to what is exactly correct. Both the articles are posted on credible sites. I am working on VS2013 with a trial account for azure. What am I missing?

Answer

BrentDaCodeMonkey picture BrentDaCodeMonkey · Feb 20, 2014

The Partition Key + the Row Key together act as a primary key for that entry into the table, this combination must be unique. You can have a virtually unlimited number of rowkeys within a single partition, as long as you don't violate the PK+RK=unique constraint.

Keep in mind however, that throughput scale targets for Azure table storage center around the partition. So the strategy you leverage to identify your partition key should be something that meets your needs for both scale and accessibility.