Count rows within partition in Azure table storage

后端 未结 5 985
余生分开走
余生分开走 2020-12-16 00:42

I\'ve seen various questions around SO about how to get the total row count of an Azure storage table, but I want to know how to get the number of rows with

5条回答
  •  春和景丽
    2020-12-16 01:11

    As you may already know that there's no Count like functionality available in Azure Tables. In order to get the total number of entities (rows) in a Partition (or a Table), you have to fetch all entities.

    You can reduce the response payload by using a technique called Query Projection. A query projection allows you to specify the list of entity attributes (columns) that you want table service to return. Since you're only interested in total count of entities, I would recommend that you only fetch PartitionKey back. You may find this blog post helpful for understanding about Query Projection: https://blogs.msdn.microsoft.com/windowsazurestorage/2011/09/15/windows-azure-tables-introducing-upsert-and-query-projection/.

提交回复
热议问题