Nick Chan Abdullah
Nick Chan Abdullah

Reputation: 375

Azure Table Storage data modeling considerations

I have a list of users. A user can either login either using username or e-mail address.

As a beginner in azure table storage, this is what I do for the data model for fast index scan.

PartitionKey    RowKey                        Property
users:email     [email protected]               nickname:jack123
users:username  jack123                       email:[email protected]

So when a user logs in via email, I would supply PartitionKey eq users:email in the azure table query. If it is username, Partition eq users:username.

Since it doesn't seem possible to simulate contains or like in azure table query, I'm wondering if this is a normal practice to store multiple row of data for 1 user ?

Upvotes: 1

Views: 87

Answers (1)

Gaurav Mantri
Gaurav Mantri

Reputation: 136126

Since it doesn't seem possible to simulate contains or like in azure table query, I'm wondering if this is a normal practice to store multiple row of data for 1 user ?Since it doesn't seem possible to simulate contains or like in azure table query, I'm wondering if this is a normal practice to store multiple row of data for 1 user ?

This is a perfectly valid practice and in fact is a recommended practice. Essentially you will have to identify the attributes on which you could potentially query your table storage and somehow use them as a combination of PartitionKey and RowKey.

Please see Guidelines for table design for more information. From this link:

Consider storing duplicate copies of entities. Table storage is cheap so consider storing the same entity multiple times (with different keys) to enable more efficient queries.

Upvotes: 2

Related Questions