I would like to add a few things to @Click-Rex's answer:
- As David mentioned Table Storage is slower if you query it improperly i.e. your queries are doing full table scan. So if you design your Partitions really well, you should get better performance than SQL Azure.
- Table storage is dirt cheap compared to SQL Azure.
- Do realize that SQL Azure is kind of
high density SQL server hosting
thus you may be impacted by noisy neighbor
behavior. Table storage is somewhat safe from that as the isolation boundary is first your storage account, then the table and then PartitionKey.
The approach presented by @Click-Rex is the way to go though I would like to one more thing:
In your additional tables, duplicate the books and user information as well and not just BookId and UserId
. That way you're reading from just one table instead of doing multiple reads. The downside of this approach is that you have to make sure that whenever book information or user information gets changed, you would need to update these tables as well but the plus side is that you would save a lot on read operations. For example, let's say you want to find out the books owned by a user. If you don't store the book information in this secondary table, first you would fetch all row keys (book ids) from this secondary table and then for each book id you would fetch information about the book from the books table. Assuming a user has 500 books, you are performing 500+1 read transactions. However if you store the book information in the secondary table itself, then you're just doing 1 read operation.
Obviously this approach would make sense if the application is performing more reads than writes
. Another thing you would need to keep in mind is that you won't get transaction support as you would be writing across many tables and partitions so you would need to ensure that entities get persisted no matter what. In an application that I am building right now, we are following this approach and we actually have a worker role responsible for ensuring that the data gets persisted.