Azure tables are ideal for storing structured, non-relational data. Common uses of Table storage include:
- Storing TBs of structured data capable of serving web scale applications
- Storing datasets that don't require complex joins, foreign keys, or stored procedures and can be denormalized for fast access
- Quickly querying data using a clustered index
- Accessing data using the OData protocol and LINQ queries with WCF Data Service .NET Libraries
Retreive Entity
TableOperation TO = TableOperation.Retreive(PartitionKey, Rowkey);
TableResult TR = TableEmp.Execute(TO);
EmpEntity emp = TR.Result;
Update Entity
Update proprties of emp
TableOperation TO = TableOperation.Replace(emp);
TableEmp.Execute(TO)
Delete Entity
TableOperation TO = TableOperation.Delete(Entity)
TableEmp.Execute(TO)
Optimization Techniques
- Read First: Read first the entity using Partition name + Row key
- Multiple Keys: Keep multiple keys, if data is duplicating no worries
- Compound Key: You can make Row key as a compound key
Ex. If you store 2 values (Id and Email) in Row key, you can search with any of the mob. or email, this is a compound key. Id_<Id> and Email_<Email>PartitionKeyRowKeyEmpNameEmployeeId_1001MeghaEmployeeId_1002RenukaEmployeeTomarEmployeeMukesh - Avoid unnecessary tables: Try to keep all related entities in one table separated by Partition key. Makes transactions smooth (commit/rollback)
Ex. Emp, EmpDetails - Inter Partition Pattern: Keeping multiple type values in row key
Keeping multiple values to divide search load, like people searching with email id will search with a key like "Email_ %"
Compound Key example (point no.3) is an Inter Partition pattern example. - Intra Partition Pattern: Dividing search by using multiple Partition key is Intra Partition Pattern.PartitionKeyRowKeyEmpNameEmployeeId1001MeghaEmployeeId1002RenukaEmployeeEmailTomarEmployeeEmailMukesh
- Delete Partition Pattern: This enables bulk delete. When you delete data based on the partition key.
Ex. you can delete any month data in a single operation.PARTITIONKEY
ROWKEY
EMPNAME
EMPLOYEE-JAN201001MeghaEMPLOYEE-JAN201002RenukaEMPLOYEE-JAN201003TomarEMPLOYEE-FEB201004MukeshEMPLOYEE-FEB201005Kailash - Large Entity Pattern: In case you are storing image/binary data you can use blog to store
- Long table Pattern: In case you have large no. of columns in your entity
No comments:
Post a Comment