Take the 2-minute tour ×

I want to understand the Partion key and Row Key.?

I understand the definitions PartitionKey to automatically distribute the table’s entities over many storage nodes. Same PartitionKey are stored on the same node. T The RowKey is the unique ID of the entity within the partition it belongs to.

so if I have a record like:


Attendance signed by Teacher:

in this case how to I define this table. I really did not understand the partitionkey and Row key in implemantation. from defination I understand them. given the records I want to insert how do I define them.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

This isn't strictly correct, but the way you can view partition key's is they define a 'group', and row keys identify specific records within that group.

It's important to understand how Azure Storage works, in order to model your data most efficiently. You're correct that partition's are stored on the same node, and the only indexes you have (for fast lookups) are partition keys and row keys.

In your student record example, what's this record being used for, or rather, how are records "grouped" together? If this is a class attendance list, maybe your PartitionKey is the course id, and RowKey's are individual student id's (PartitionKey = CourseId, RowKey = StudentId). In this case, you can fetch an entire partition and get the full course roster, or you can look up an individual student with PartitionKey + RowKey.

Another way might be to give each student their own partition (PartitionKey = StudentId), and then row key's are specific dates (RowKey = Date). With this model, you can quickly fetch a student's entire attendance history by querying just the PartitionKey, or if you want to see whether they were in attendance on a specific day, query PartitionKey + RowKey (StudentId + Date).

There's multiple way's to model your data. It just depends on how you're using these specific records for what's optimal.

share|improve this answer
Thanks a lot for detail explanation. I need to do look ups a lot based on student ID and Date to get his Presence in this course. for that use case: I have 3 parameters which will always be there in my search. is it ok if I keep partision as Student and Row as Date and Presence a parameter not as key –  The Learner Oct 31 '12 at 6:42
Yes, that would work. As long as you're filtering on PartitonKey + RowKey, your queries should be fast. –  mfanto Oct 31 '12 at 6:49
Thankq @mfanto. –  The Learner Oct 31 '12 at 6:50
add comment

Your Answer


