关于SO如何获得Azure存储表的总计行计数,我已经看到了各种围绕SO的问题,但是我想知道如何获得单个分区中的行数./p>
在将最小数量的实体数据加载到内存中时,我该怎么做?
解决方案您可能已经知道Azure表中没有可用的Count之类的功能.为了获取分区(或表)中实体(行)的总数,您必须获取所有实体.
您可以使用称为Query Projection的技术来减少响应负载.查询投影使您可以指定要表服务返回的实体属性(列)的列表.由于您只对实体的总数感兴趣,因此建议您仅取回PartitionKey.您可能会发现此博客文章对理解查询投影很有帮助: blogs.msdn.microsoft/windowsazurestorage/2011/09/15/windows-azure-tables-introducing-upsert-and-query-projection/.
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 within a single partition.
How can I do this while loading a minimal amount of entity data into memory?
解决方案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: blogs.msdn.microsoft/windowsazurestorage/2011/09/15/windows-azure-tables-introducing-upsert-and-query-projection/.
更多推荐
计算Azure表存储中分区内的行
发布评论