Q72. What are Entity Group Transactions?
Entity Group transaction is similar to the atomic transaction concept in SQL Server. Entity Group transaction can be performed on a single partition.
With this feature we can perform multiple CRUD operations on entities within a single partition in a single batch operation. That means these operations can be performed on entities having same partition key within a single table.
You choose a partition key to ensure atomic transactions are possible on a set of entities. Let us consider the Customer table where customer details and his invoice details are stored together. To support transactions that span the header and detail records of the invoice a partition key that includes the CustomerID will help to perform entity group transactions. In an Entity Group transaction, we can perform one operation against a single entity. And this rule is enforced by Azure Table Storage.
If an operation on an entity in an Entity Transaction fails, the entire transaction is rolled back. A transaction can include 100 entities at the maximum, and its total size should not exceed more than 4 MB in size.
In a real time situation when multiple updates are happening, other queries see the data which is successfully committed.
Every transaction is charged by azure. So, it makes sense to include multiple operations on entities in a single partition into one Entity group transaction. When we do this Azure treats the Entity Group Transaction as a single transaction and apply the charge for it.
When we design an azure based accounting software, we should note that we cannot use the account number as the Partition key when we perform entity group transactions. This is because entity group transactions happen in a single partition and every accounting transaction includes two unique account numbers one to which the amount is debited and other to which amount is credited. So, we can overcome the problem by choosing the transaction key as the partition key.
You choose a partition key to ensure atomic transactions are possible on a set of entities. Let us consider the Customer table where customer details and his invoice details are stored together. To support transactions that span the header and detail records of the invoice a partition key that includes the CustomerID will help to perform entity group transactions. In an Entity Group transaction, we can perform one operation against a single entity. And this rule is enforced by Azure Table Storage.
If an operation on an entity in an Entity Transaction fails, the entire transaction is rolled back. A transaction can include 100 entities at the maximum, and its total size should not exceed more than 4 MB in size.
In a real time situation when multiple updates are happening, other queries see the data which is successfully committed.
Benefit of Entity Group Transaction
Every transaction is charged by azure. So, it makes sense to include multiple operations on entities in a single partition into one Entity group transaction. When we do this Azure treats the Entity Group Transaction as a single transaction and apply the charge for it.
In an accounting software application why should we not use the account number as the Partition key?
When we design an azure based accounting software, we should note that we cannot use the account number as the Partition key when we perform entity group transactions. This is because entity group transactions happen in a single partition and every accounting transaction includes two unique account numbers one to which the amount is debited and other to which amount is credited. So, we can overcome the problem by choosing the transaction key as the partition key.
See More Questions and Answers on - Azure Table Storage
- Why should i use Azure table storage?
- What are the benefits of table storage?
- Difference between sql database table and Azure storage table?
- Explain Azure table storage data model?
- why to partition Azure table?
- What is Azure table primary key?
- Guidelines on how to choose partition key and row key?
- Explain how partition key is linked to scalability?
- How do partitions work in storage services like blobs and queues?