For example, if the queries that look up the entities using the email address in the RowKey never need the employee's age, these entities could have the following structure: You do not necessarily need to duplicate all the properties of your entity. Padding numeric values in the RowKey (for example, the employee ID 000223), enables correct sorting and filtering based on upper and lower bounds. The value used for the RowKey must be unique for each entity. For more information, see the section Using Entity Group Transactions. This implies that you should store all copies of an entity in the same partition. You can keep your duplicate entities consistent with each other by using EGTs to update the two copies of the entity atomically. However, you should always evaluate the cost of your design based on your anticipated storage requirements and only add duplicate entities to support the queries your client application will execute.īecause the secondary index entities are stored in the same partition as the original entities, you should ensure that you do not exceed the scalability targets for an individual partition. Table storage is relatively cheap to use so the cost overhead of storing duplicate data should not be a major concern. The filter syntax used in the examples above is from the Table service REST API, for more information, see Query Entities.Ĭonsider the following points when deciding how to implement this pattern: $filter=(PartitionKey eq 'Sales') and (RowKey ge 'email_a') and (RowKey lt 'email_b') To find all the employees in the Sales department with an email address starting with the letter 'a' use: $filter=(PartitionKey eq 'Sales') and (RowKey ge 'empid_000100') and (RowKey le 'empid_000199') To find all the employees in the Sales department with an employee ID in the range 000100 to 000199 use:
0 Comments
Leave a Reply. |