0
votes

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:

StudentName:
StudentId:

Date:
Attendence:
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.

1

1 Answers

1
votes

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.